diff mbox

Fix out-of-bound array accesses in testcases

Message ID CAFULd4ZQknSu9-UYEzJrALyTDfbnY7u4HdbwGFH=shvMcAnxjg@mail.gmail.com
State New
Headers show

Commit Message

Uros Bizjak April 20, 2012, 4:38 p.m. UTC
Hello!

> So, a patch of mine runs into the following testsuite issues.  Fixed
> with the following patch, tested on x86_64-unknown-linux-gnu and
> committed.

> 2012-04-18  Richard Guenther  <rguenther@suse.de>
>
>	* gcc.target/x86_64/abi/test_passing_unions.c: Avoid undefined
>	array access.
>	* gcc.target/x86_64/abi/test_passing_structs.c: Likewise.
>	* gcc.target/i386/avx256-unaligned-load-4.c: Fix array sizes.

Attached patch also fixes AVX failures.

2012-04-20  Uros Bizjak  <ubizjak@gmail.com>

	* gcc.target/x86_64/abi/avx/test_passing_unions.c: Avoid undefined
	array access.
	* gcc.target/x86_64/abi/avx/test_passing_structs.c: Likewise.

Tested on x86_64-pc-linux-gnu AVX target, committed to mainline SVN.

Uros.
diff mbox

Patch

Index: gcc.target/x86_64/abi/avx/test_passing_structs.c
===================================================================
--- gcc.target/x86_64/abi/avx/test_passing_structs.c	(revision 186624)
+++ gcc.target/x86_64/abi/avx/test_passing_structs.c	(working copy)
@@ -53,7 +53,7 @@ 
 
   clear_struct_registers;
   for (i = 0; i < 8; i++)
-    fregs.ymm0._m256[i] = m256s[i].x;
+    (&fregs.ymm0)[i]._m256[0] = m256s[i].x;
   num_fregs = 8;
   WRAP_CALL (check_struct_passing1)(m256s[0], m256s[1], m256s[2], m256s[3],
 				    m256s[4], m256s[5], m256s[6], m256s[7]);
Index: gcc.target/x86_64/abi/avx/test_passing_unions.c
===================================================================
--- gcc.target/x86_64/abi/avx/test_passing_unions.c	(revision 186624)
+++ gcc.target/x86_64/abi/avx/test_passing_unions.c	(working copy)
@@ -113,7 +113,7 @@ 
 
   clear_struct_registers;
   for (i = 0; i < 8; i++)
-    fregs.ymm0._m256[i] = u1[i].x;
+    (&fregs.ymm0)[i]._m256[0] = u1[i].x;
   num_fregs = 8;
   check_union_passing1(u1[0], u1[1], u1[2], u1[3],
 		       u1[4], u1[5], u1[6], u1[7]);
@@ -122,7 +122,7 @@ 
   for (i = 0; i < 8; i++)
     {
       u2[i].x = u1[i].x;
-      fregs.ymm0._m256[i] = u2[i].x;
+      (&fregs.ymm0)[i]._m256[0] = u2[i].x;
     }
   num_fregs = 8;
   check_union_passing2(u2[0], u2[1], u2[2], u2[3],
@@ -132,7 +132,7 @@ 
   for (i = 0; i < 8; i++)
     {
       u3[i].x = u1[i].x;
-      fregs.ymm0._m256[i] = u3[i].x;
+      (&fregs.ymm0)[i]._m256[0] = u3[i].x;
     }
   num_fregs = 8;
   check_union_passing3(u3[0], u3[1], u3[2], u3[3],