Merge from trunk
[official-gcc.git] / gcc / testsuite / gcc.dg / torture / pr60183.c
blob3f676637ba8c3a37890150f764fa55c332f59c4c
1 /* { dg-do run } */
2 /* { dg-require-effective-target size32plus } */
4 /* Large so an out-of-bound read will crash. */
5 unsigned char c[0x30001] = { 1 };
6 int j = 2;
8 static void
9 foo (unsigned long *x, unsigned char *y)
11 int i;
12 unsigned long w = x[0];
13 for (i = 0; i < j; i++)
15 w += *y;
16 y += 0x10000;
17 w += *y;
18 y += 0x10000;
20 x[1] = w;
23 __attribute__ ((noinline, noclone)) void
24 bar (unsigned long *x)
26 foo (x, c);
29 int
30 main ()
32 unsigned long a[2] = { 0, -1UL };
33 asm volatile (""::"r" (c):"memory");
34 c[0] = 0;
35 bar (a);
36 if (a[1] != 0)
37 __builtin_abort ();
38 return 0;