summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa/20040729-1.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/tree-ssa/20040729-1.c')
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/20040729-1.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/20040729-1.c b/gcc/testsuite/gcc.dg/tree-ssa/20040729-1.c
new file mode 100644
index 000000000..ef94096fa
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/20040729-1.c
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fdump-tree-dce2" } */
+
+foo ()
+{
+ volatile int *p;
+ volatile int x;
+
+ p = &x;
+ *p = 3;
+ return *p + 1;
+}
+
+/* The assignment to 'p' is dead and should be removed. But the
+ compiler was mistakenly thinking that the statement had volatile
+ operands. But 'p' itself is not volatile and taking the address of
+ a volatile does not constitute a volatile operand. */
+/* { dg-final { scan-tree-dump-times "&x" 0 "dce2"} } */
+/* { dg-final { cleanup-tree-dump "dce2" } } */