1 /* PR tree-optimization/51466 */ 2 3 extern void abort (void); 4 5 __attribute__((noinline, noclone)) int foo(int i)6foo (int i) 7 { 8 volatile int v[4]; 9 int *p; 10 v[i] = 6; 11 p = (int *) &v[i]; 12 return *p; 13 } 14 15 __attribute__((noinline, noclone)) int bar(int i)16bar (int i) 17 { 18 volatile int v[4]; 19 int *p; 20 v[i] = 6; 21 p = (int *) &v[i]; 22 *p = 8; 23 return v[i]; 24 } 25 26 __attribute__((noinline, noclone)) int baz(int i)27baz (int i) 28 { 29 volatile int v[4]; 30 int *p; 31 v[i] = 6; 32 p = (int *) &v[0]; 33 *p = 8; 34 return v[i]; 35 } 36 37 int main()38main () 39 { 40 if (foo (3) != 6 || bar (2) != 8 || baz (0) != 8 || baz (1) != 6) 41 abort (); 42 return 0; 43 } 44