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