| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O1 -fdump-tree-dce3" } */ |
| 3 |
|
| 4 |
int |
| 5 |
foo () |
| 6 |
{ |
| 7 |
volatile int *p; |
| 8 |
volatile int x; |
| 9 |
|
| 10 |
p = &x; |
| 11 |
*p = 3; |
| 12 |
return *p + 1; |
| 13 |
} |
| 14 |
|
| 15 |
/* The assignment to 'p' is dead and should be removed. But the |
| 16 |
compiler was mistakenly thinking that the statement had volatile |
| 17 |
operands. But 'p' itself is not volatile and taking the address of |
| 18 |
a volatile does not constitute a volatile operand. */ |
| 19 |
/* { dg-final { scan-tree-dump-times "&x" 0 "dce3"} } */ |