------- Comment #6 from aldyh at gcc dot gnu dot org 2007-12-04 19:30 -------
Ok, here's the deal.
gimplify_init_constructor promotes the constructor to a static because it is a
const aggregate variable, here:
/* If a const aggregate variable is being initialized, then it
should never be a lose to promote the variable to be static. */
if (valid_const_initializer
...
This isn't a good idea if we are initializing bitfields from static numbers.
If I keep the compiler from promoting to static in the above code, the
gimplifier splits the constructor into independent assignments:
init = {};
init.a1 = 1;
init.a2 = 5;
...which later combine munges into the expected constant, thus fixing the
problem reported.
Perhaps we should keep the above code from executing if initializing a
structure containing only bitfields that fit into a HOST_WIDE_INT, something we
can do with one move? Or is there a better generalization we can code here?
Any suggestions?
--
aldyh at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |dnovillo at google dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32901