diff options
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/gcc.dg/tree-ssa/alias-38.c | 14 | ||||
-rw-r--r-- | gcc/tree-ssa-structalias.cc | 7 |
2 files changed, 21 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/alias-38.c b/gcc/testsuite/gcc.dg/tree-ssa/alias-38.c new file mode 100644 index 0000000..a5c4149 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/alias-38.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ + +int x; +int y; + +int main () +{ + int *volatile p = &x; + return (p != &y); +} + +/* { dg-final { scan-tree-dump " != &y" "optimized" } } */ +/* { dg-final { scan-tree-dump-not "return 1;" "optimized" } } */ diff --git a/gcc/tree-ssa-structalias.cc b/gcc/tree-ssa-structalias.cc index bb59c6a..0bac1a1 100644 --- a/gcc/tree-ssa-structalias.cc +++ b/gcc/tree-ssa-structalias.cc @@ -3575,6 +3575,10 @@ get_constraint_for_1 (tree t, vec<ce_s> *results, bool address_p, } case tcc_reference: { + if (TREE_THIS_VOLATILE (t)) + /* Fall back to anything. */ + break; + switch (TREE_CODE (t)) { case MEM_REF: @@ -3676,6 +3680,9 @@ get_constraint_for_1 (tree t, vec<ce_s> *results, bool address_p, } case tcc_declaration: { + if (VAR_P (t) && TREE_THIS_VOLATILE (t)) + /* Fall back to anything. */ + break; get_constraint_for_ssa_var (t, results, address_p); return; } |