gcc/testsuite/c-c++-common/guality/Og-dce-2.c
raw| 1 | /* { dg-do run } */ |
| 2 | /* { dg-options "-g" } */ |
| 3 | |
| 4 | struct s { int a, b, c, d; }; |
| 5 | |
| 6 | struct s gs1 = { 1, 2, 3, 4 }; |
| 7 | struct s gs2 = { 5, 6, 7, 8 }; |
| 8 | |
| 9 | struct s *__attribute__((noipa)) consume (struct s *ptr) { return ptr; } |
| 10 | |
| 11 | int |
| 12 | main (void) |
| 13 | { |
| 14 | struct s x; |
| 15 | struct s *volatile ptr = consume (&x); |
| 16 | x = gs1; |
| 17 | x = gs2; /* { dg-final { gdb-test . "ptr->a" "1" } } */ |
| 18 | return 0; /* { dg-final { gdb-test . "ptr->a" "5" } } */ |
| 19 | } |