aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/20040729-1.c
blob: ef94096fa0d9e8534fe549d80a2cd3fd28826540 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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" } } */