From: Jakub Jelinek Date: Mon, 18 Mar 2013 13:01:49 +0000 (+0100) Subject: re PR tree-optimization/56635 (internal compiler error: in find_lattice_value, at... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=38c56a5b2121ab8f12e153e02cea4da777689ce4;p=gcc.git re PR tree-optimization/56635 (internal compiler error: in find_lattice_value, at tree-complex.c:15) PR tree-optimization/56635 * fold-const.c (operand_equal_p): For MEM_REF and TARGET_MEM_REF, require types_compatible_p types. * g++.dg/torture/pr56635.C: New test. From-SVN: r196781 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0bae8e64825..de91c80b3f7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2013-03-18 Jakub Jelinek + + PR tree-optimization/56635 + * fold-const.c (operand_equal_p): For MEM_REF and TARGET_MEM_REF, + require types_compatible_p types. + 2013-03-18 Nick Clifton * config/stormy16/stormy16.c (xstormy16_expand_prologue): Remove diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 26cfc0e83e4..de7117e8e87 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -2572,13 +2572,14 @@ operand_equal_p (const_tree arg0, const_tree arg1, unsigned int flags) flags &= ~OEP_CONSTANT_ADDRESS_OF; /* Require equal access sizes, and similar pointer types. We can have incomplete types for array references of - variable-sized arrays from the Fortran frontent - though. */ + variable-sized arrays from the Fortran frontend + though. Also verify the types are compatible. */ return ((TYPE_SIZE (TREE_TYPE (arg0)) == TYPE_SIZE (TREE_TYPE (arg1)) || (TYPE_SIZE (TREE_TYPE (arg0)) && TYPE_SIZE (TREE_TYPE (arg1)) && operand_equal_p (TYPE_SIZE (TREE_TYPE (arg0)), TYPE_SIZE (TREE_TYPE (arg1)), flags))) + && types_compatible_p (TREE_TYPE (arg0), TREE_TYPE (arg1)) && (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_OPERAND (arg0, 1))) == TYPE_MAIN_VARIANT (TREE_TYPE (TREE_OPERAND (arg1, 1)))) && OP_SAME (0) && OP_SAME (1)); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 20b206ae460..4240674fcd1 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-03-18 Jakub Jelinek + + PR tree-optimization/56635 + * g++.dg/torture/pr56635.C: New test. + 2013-03-18 Richard Biener PR tree-optimization/3713 diff --git a/gcc/testsuite/g++.dg/torture/pr56635.C b/gcc/testsuite/g++.dg/torture/pr56635.C new file mode 100644 index 00000000000..53d6bb96ad5 --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr56635.C @@ -0,0 +1,17 @@ +// PR tree-optimization/56635 +// { dg-do compile } + +struct A { _Complex double a; }; + +void +foo (A **x, A **y) +{ + A r; + if (__real__ x[0]->a) + { + r.a = y[0]->a / x[0]->a; + **x = r; + } + else + **x = **y; +}