PATCH to gimplify_init_constructor for c++/38410
Tue Dec 9 07:12:00 GMT 2008
The issue here turned out to be that on PPC, gimplify_init_constructor
was deciding to write out the all-zero CONSTRUCTOR to a static variable
and then copy it into the variable being initialized, which makes the
compiler blow up because we're doing a bitwise copy of a
I don't see any reason to write out an all-zero CONSTRUCTOR to a static
variable, and indeed the comment "don't do this for sparse arrays" in
gimplify_init_constructor suggests that it's not intended. So this
patch makes us stop doing this for sparse arrays: previously we didn't
do it for large sparse arrays, but still did it for small sparse arrays.
It also disables this optimization for TREE_ADDRESSABLE types in case
someone wants to, say, zero-initialize a class full of pointers to
members (a null pointer to member has a non-zero bit pattern).
I notice that this function implements the clearing by setting
CONSTRUCTOR_ELTS to NULL; is that an acceptable expression of "set
everything to 0" for a front end to generate?
Tested x86_64-pc-linux-gnu, applied to trunk.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 3969 bytes
Desc: not available
More information about the Gcc-patches