gcc/testsuite/gcc.c-torture/execute/20030913-1.c
raw| 1 | /* Assignments via pointers pointing to global variables were being killed |
| 2 | by SSA-DCE. Test contributed by Paul Brook <[email protected]> */ |
| 3 | |
| 4 | void abort (void); |
| 5 | void exit (int); |
| 6 | |
| 7 | int g; |
| 8 | |
| 9 | void |
| 10 | fn2(int ** q) |
| 11 | { |
| 12 | *q = &g; |
| 13 | } |
| 14 | |
| 15 | void test() |
| 16 | { |
| 17 | int *p; |
| 18 | |
| 19 | fn2(&p); |
| 20 | |
| 21 | *p=42; |
| 22 | } |
| 23 | |
| 24 | int main() |
| 25 | { |
| 26 | test(); |
| 27 | if (g != 42) abort(); |
| 28 | exit (0); |
| 29 | } |