diff options
author | Jakub Jelinek <jakub@redhat.com> | 2013-03-18 14:01:49 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2013-03-18 14:01:49 +0100 |
commit | 38c56a5b2121ab8f12e153e02cea4da777689ce4 (patch) | |
tree | edd39377c62a36f1b67537647bc63e14c31e0e78 /gcc/fold-const.c | |
parent | a6178a256dcec7f9ad2475ef5192dd3c05e2633f (diff) | |
download | gcc-38c56a5b2121ab8f12e153e02cea4da777689ce4.zip gcc-38c56a5b2121ab8f12e153e02cea4da777689ce4.tar.gz gcc-38c56a5b2121ab8f12e153e02cea4da777689ce4.tar.bz2 |
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
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r-- | gcc/fold-const.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 26cfc0e..de7117e 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)); |