| 1 |
/* PR tree-optimization/94734 */ |
| 2 |
|
| 3 |
__attribute__((noipa)) int |
| 4 |
foo (int n) |
| 5 |
{ |
| 6 |
int arr[16], s = 0; |
| 7 |
for (int i = 0; i < n; i++) |
| 8 |
{ |
| 9 |
if (i < 16) |
| 10 |
arr[i] = i; |
| 11 |
} |
| 12 |
for (int i = 0; i < 16; i++) |
| 13 |
s += arr[i]; |
| 14 |
return s; |
| 15 |
} |
| 16 |
|
| 17 |
__attribute__((noipa)) int |
| 18 |
bar (int n, int x, unsigned long y, unsigned long z) |
| 19 |
{ |
| 20 |
int arr[16], s = 0; |
| 21 |
arr[4] = 42; |
| 22 |
for (int i = 0; i < n; i++) |
| 23 |
{ |
| 24 |
if (x == (i & 0x25)) |
| 25 |
arr[y] = i; |
| 26 |
} |
| 27 |
return arr[z]; |
| 28 |
} |
| 29 |
|
| 30 |
__attribute__((noipa)) int |
| 31 |
baz (int n, int x, unsigned long z) |
| 32 |
{ |
| 33 |
int arr[16], s = 0; |
| 34 |
arr[12] = 42; |
| 35 |
for (int i = 0; i < n; i++) |
| 36 |
{ |
| 37 |
if (x == (i & 0x25)) |
| 38 |
arr[7] = i; |
| 39 |
} |
| 40 |
return arr[z]; |
| 41 |
} |
| 42 |
|
| 43 |
int |
| 44 |
main () |
| 45 |
{ |
| 46 |
if (foo (10374) != 15 * 16 / 2) |
| 47 |
__builtin_abort (); |
| 48 |
if (bar (25, 0x25, (unsigned long) 0xdeadbeefbeefdeadULL, 4) != 42) |
| 49 |
__builtin_abort (); |
| 50 |
if (bar (25, 4, 15, 15) != 22) |
| 51 |
__builtin_abort (); |
| 52 |
if (baz (25, 0x25, 12) != 42) |
| 53 |
__builtin_abort (); |
| 54 |
if (baz (25, 4, 7) != 22) |
| 55 |
__builtin_abort (); |
| 56 |
if (baz (25, 4, 12) != 42) |
| 57 |
__builtin_abort (); |
| 58 |
return 0; |
| 59 |
} |