[Bug libstdc++/50268] [C++0x] bitset doesn't sanitize input

marc.glisse at normalesup dot org gcc-bugzilla@gcc.gnu.org
Fri Sep 2 12:24:00 GMT 2011


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

--- Comment #13 from Marc Glisse <marc.glisse at normalesup dot org> 2011-09-02 12:23:33 UTC ---
(In reply to comment #12)
> Created attachment 25178 [details]
> Work in progress patch for the _M_are_all_aux issue
> 
> I'm considering doing something like this: what do you think? Can we tidy
> somehow the general case (_Nw > 1)? (patch already passes the existing
> bitset::all test)

Doesn't _Base_bitset<1> also need a special case for
_Nb==_GLIBCXX_BITSET_BITS_PER_WORD ?
I think we could express the constant as
~static_cast<_WordT>(0)>>(_GLIBCXX_BITSET_BITS_PER_WORD-_Nb) so we don't need a
special case (and something similar for the last word of the generic
_Base_bitset)



More information about the Gcc-bugs mailing list