aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-ccp.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2009-04-22 15:41:48 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2009-04-22 15:41:48 +0000
commitaea4deba9fe05d970dff5a8f16c584680243319f (patch)
tree830677aad4b37fb8c1aebd51f53cf58a6b139f58 /gcc/tree-ssa-ccp.c
parentcfc935327585254eabd5c18f298b1b4bc28a2b02 (diff)
downloadgcc-aea4deba9fe05d970dff5a8f16c584680243319f.zip
gcc-aea4deba9fe05d970dff5a8f16c584680243319f.tar.gz
gcc-aea4deba9fe05d970dff5a8f16c584680243319f.tar.bz2
re PR middle-end/39824 (ice in fold-const.c)
2009-04-22 Richard Guenther <rguenther@suse.de> PR tree-optimization/39824 * tree-ssa-ccp.c (fold_const_aggregate_ref): For INDIRECT_REFs make sure the types are compatible. * gcc.c-torture/compile/pr39824.c: New testcase. From-SVN: r146592
Diffstat (limited to 'gcc/tree-ssa-ccp.c')
-rw-r--r--gcc/tree-ssa-ccp.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c
index 9cf2f83..437d426 100644
--- a/gcc/tree-ssa-ccp.c
+++ b/gcc/tree-ssa-ccp.c
@@ -1329,7 +1329,9 @@ fold_const_aggregate_ref (tree t)
if (TREE_CODE (base) == SSA_NAME
&& (value = get_value (base))
&& value->lattice_val == CONSTANT
- && TREE_CODE (value->value) == ADDR_EXPR)
+ && TREE_CODE (value->value) == ADDR_EXPR
+ && useless_type_conversion_p (TREE_TYPE (t),
+ TREE_TYPE (TREE_TYPE (value->value))))
return fold_const_aggregate_ref (TREE_OPERAND (value->value, 0));
break;
}