OSDN Git Service

2012-02-28 Richard Guenther <rguenther@suse.de>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / torture / pr50067-5.c
1 /* { dg-do run } */
2
3 /* Verify we do not get a bogus access function pairs with
4    exchanged dimensions, 0, {1, +, 1}_1 vs. {2B, +, 1}_1, 0 which
5    disambiguates both accesses and leads to vectorization.  */
6
7 extern int memcmp(const void *, const void *, __SIZE_TYPE__);
8 extern void abort (void);
9 short a[33] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31 };
10 short b[33] = { 0, };
11 char * volatile ap_ = (char *)&a[0];
12 int main()
13 {
14 #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
15   int i;
16   char *ap = ap_;
17   if (sizeof (short) == 2)
18     {
19       for (i = 0; i < 64; ++i)
20         {
21           (*((char(*)[])&ap[i+2]))[0] = (*((char(*)[])&ap[0]))[i+1];
22         }
23       if (memcmp (&a, &b, sizeof (a)) != 0)
24         abort ();
25     }
26 #endif
27   return 0;
28 }