------- Additional Comments From steven at gcc dot gnu dot org 2005-09-16
09:58 -------
This fixes it. Sadly only store-ccp propagates constants out of
initializers right now, which is a separate bug -- we _do_ find the
constant in the initializer... but then we don't propagate it for
some reason. I'm also looking into that.
Index: tree-ssa-ccp.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-ccp.c,v
retrieving revision 2.87
diff -u -3 -p -r2.87 tree-ssa-ccp.c
--- tree-ssa-ccp.c 17 Aug 2005 07:27:38 -0000 2.87
+++ tree-ssa-ccp.c 16 Sep 2005 09:56:43 -0000
@@ -1045,6 +1045,15 @@ fold_const_aggregate_ref (tree t)
return cval;
break;
+ case REALPART_EXPR:
+ case IMAGPART_EXPR:
+ {
+ tree c = fold_const_aggregate_ref (TREE_OPERAND (t, 0));
+ if (c && TREE_CODE (c) == COMPLEX_CST)
+ return fold_build1 (TREE_CODE (t), TREE_TYPE (t), c);
+ break;
+ }
+
default:
break;
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23911