http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52979
--- Comment #7 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-04-24
12:28:24 UTC ---
Btw, get_best_mode for
Breakpoint 6, get_best_mode (bitsize=6, bitpos=31, bitregion_start=0,
bitregion_end=39, align=128, largest_mode=DImode, volatilep=0)
happily returns DImode which has more than maxbits (40) bits of size.
I think the C++ memory model work was not sufficiently completed to
handle this case during expansion.
At least
/* Find the narrowest integer mode that contains the bit field. */
for (mode = GET_CLASS_NARROWEST_MODE (MODE_INT); mode != VOIDmode;
mode = GET_MODE_WIDER_MODE (mode))
{
unit = GET_MODE_BITSIZE (mode);
if (unit == GET_MODE_PRECISION (mode)
&& (bitpos % unit) + bitsize <= unit)
break;
}
is overly pessimistic in the (bitpos % unit) + bitsize <= unit check and
does not consider bitpos adjustments.