From: Richard Biener Date: Wed, 5 Aug 2015 12:47:59 +0000 (+0000) Subject: re PR middle-end/67120 (wrong code for volatile pointers at -O1 and above on x86_64... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=aad88aede922888994eda29d6847cf557b50a7fd;p=gcc.git re PR middle-end/67120 (wrong code for volatile pointers at -O1 and above on x86_64-linux-gnu) 2015-08-05 Richard Biener PR middle-end/67120 * match.pd: Compare address bases with == if they are decls or SSA names, not operand_equal_p. Otherwise fail. * gcc.dg/torture/pr67120.c: New testcase. From-SVN: r226623 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ff02e192470..349bbcb8f38 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2015-08-05 Richard Biener + + PR middle-end/67120 + * match.pd: Compare address bases with == if they are decls + or SSA names, not operand_equal_p. Otherwise fail. + 2015-08-05 Richard Biener PR tree-optimization/67055 diff --git a/gcc/match.pd b/gcc/match.pd index 2a4f7d698e4..4230f9a7d18 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -1848,13 +1848,14 @@ along with GCC; see the file COPYING3. If not see (if (base0 && base1) (with { - int equal; + int equal = 2; if (decl_in_symtab_p (base0) && decl_in_symtab_p (base1)) equal = symtab_node::get_create (base0) ->equal_address_to (symtab_node::get_create (base1)); - else - equal = operand_equal_p (base0, base1, 0); + else if ((DECL_P (base0) || TREE_CODE (base0) == SSA_NAME) + && (DECL_P (base1) || TREE_CODE (base1) == SSA_NAME)) + equal = (base0 == base1); } (if (equal == 1 && (cmp == EQ_EXPR || cmp == NE_EXPR diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d1bb135d8bb..61d98486c1e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-08-05 Richard Biener + + PR middle-end/67120 + * gcc.dg/torture/pr67120.c: New testcase. + 2015-08-05 Paul Thomas PR fortran/52846 diff --git a/gcc/testsuite/gcc.dg/torture/pr67120.c b/gcc/testsuite/gcc.dg/torture/pr67120.c new file mode 100644 index 00000000000..d22b314bd3f --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr67120.c @@ -0,0 +1,16 @@ +/* { dg-do run } */ + +volatile int *volatile *a; +static volatile int *volatile **b = &a; + +int +main () +{ + volatile int *volatile c; + *b = &c; + + if (a != &c) + __builtin_abort (); + + return 0; +}