gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-23.c
raw| 1 | /* { dg-do compile } */ |
| 2 | /* { dg-options "-O -fdump-tree-ccp1" } */ |
| 3 | |
| 4 | /* Make sure we propagate through POINTER_PLUS_EXPRs. */ |
| 5 | |
| 6 | struct A { |
| 7 | int i[2]; |
| 8 | } a; |
| 9 | |
| 10 | int foo (void) |
| 11 | { |
| 12 | struct A *p = &a; |
| 13 | int *q = (int *)p; |
| 14 | int *x = q + 1; |
| 15 | return *x; |
| 16 | } |
| 17 | |
| 18 | /* { dg-final { scan-tree-dump "MEM\\\[\\\(int \\\*\\\)&a \\\+ 2B\\\]" "ccp1" { target { int16 } } } } */ |
| 19 | /* { dg-final { scan-tree-dump "MEM\\\[\\\(int \\\*\\\)&a \\\+ 4B\\\]" "ccp1" { target { int32 } } } } */ |