http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54897



--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-10-11 
07:38:19 UTC ---

The problem is that IMHO the testcase is just invalid on 32-bit HWI targets.

On 32-bit targets with 64-bit HWI, bitsizetype is 64-bit and thus

std::bitset<0xffffffff> has size 0x20000000, and bitsize 0x100000000.  But

32-bit HWI targets use 32-bit bitsizetype, thereforestd::bitset<0xffffffff> is

larger than the largest supportable type, bitsize of the array is 0 overflow,

and both bitsize and unit size of the bitset are therefore set to 0 overflow.

Before my changes, sizeof(std::bitset<0xffffffff>) yielded 0 overflow, so the

test magically passed even when sizeof 0 is as wrong as sizeof 1.  With the

patch, maybe_constant_size is used to fold the SIZEOF_EXPR, but as it is

overflown, it is not considered a valid integer constant expression, thus we

end up with size unfolded and therefore the error (or considering the array a

VLA).

Reply via email to