aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-ccp.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2010-07-02 09:14:03 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2010-07-02 09:14:03 +0000
commit3fa39831668c00d32632f72860cbacbcf8bef1cb (patch)
treee275a509ae2b4520b1fe0b16331bf4376e900379 /gcc/tree-ssa-ccp.c
parent8c7481f253d8943d16947248d76d7f717f8d7028 (diff)
downloadgcc-3fa39831668c00d32632f72860cbacbcf8bef1cb.zip
gcc-3fa39831668c00d32632f72860cbacbcf8bef1cb.tar.gz
gcc-3fa39831668c00d32632f72860cbacbcf8bef1cb.tar.bz2
re PR tree-optimization/44748 (ICE: in fold_convert_const_int_from_real, at fold-const.c:1548)
2010-07-02 Richard Guenther <rguenther@suse.de> PR tree-optimization/44748 * tree-ssa-ccp.c (fold_const_aggregate_ref): Properly handle the embedded conversion in MEM_REFs. * gcc.dg/tree-ssa/ssa-ccp-29.c: New testcase. From-SVN: r161689
Diffstat (limited to 'gcc/tree-ssa-ccp.c')
-rw-r--r--gcc/tree-ssa-ccp.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c
index 912c505..1e2309a 100644
--- a/gcc/tree-ssa-ccp.c
+++ b/gcc/tree-ssa-ccp.c
@@ -1317,7 +1317,14 @@ fold_const_aggregate_ref (tree t)
if (DECL_P (base)
&& !AGGREGATE_TYPE_P (TREE_TYPE (base))
&& integer_zerop (TREE_OPERAND (t, 1)))
- return get_symbol_constant_value (base);
+ {
+ tree res = get_symbol_constant_value (base);
+ if (res
+ && !useless_type_conversion_p
+ (TREE_TYPE (t), TREE_TYPE (res)))
+ res = fold_unary (VIEW_CONVERT_EXPR, TREE_TYPE (t), res);
+ return res;
+ }
if (!TREE_READONLY (base)
|| TREE_CODE (TREE_TYPE (base)) != ARRAY_TYPE