gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-24.c
raw| 1 | /* { dg-do compile } */ |
| 2 | /* { dg-options "-O -fdump-tree-ccp1" } */ |
| 3 | |
| 4 | static const int x; |
| 5 | int foo() |
| 6 | { |
| 7 | const int *p = &x; |
| 8 | int y = *p; |
| 9 | return y + 1; |
| 10 | } |
| 11 | |
| 12 | static const int x2[3] = { 1, 0, 2 }; |
| 13 | int bar() |
| 14 | { |
| 15 | int i = 1; |
| 16 | const int *p = &x2[i]; |
| 17 | int y = *p; |
| 18 | return y + 1; |
| 19 | } |
| 20 | |
| 21 | /* { dg-final { scan-tree-dump-times "return 1;" 2 "ccp1" } } */ |
| 22 |