[cfe-dev] -fsanitize=enum false positive with ˜ios::failbit ?

Richard Smith richard at metafoo.co.uk
Thu Feb 28 13:15:45 PST 2013


On Thu, Feb 28, 2013 at 11:36 AM, Sean McBride <sean at rogue-research.com>wrote:

> Hi all,
>
> Consider this C++:
>
> -------------------
> #include <iostream>
> int main(int argc, char **argv)
> {
>   std::ios_base::iostate foo = ~std::ios::failbit;
>
>   return foo;
> }
> -------------------
>
> $ clang --version
> clang version 3.3 (trunk 176286)
>
> $ clang -fsanitize=enum test.cxx
>
> $ ./a.out
>
> 0x000106017fde: runtime error: load of value 4294967291, which is not a
> valid value for type 'std::ios_base::iostate' (aka 'std::_Ios_Iostate')
>  e8 11 2c 00 00 8b  45 e8 48 83 c4 20 5d c3  90 90 90 90 90 90 90 90  55
> 48 89 e5 48 83 ec 10  48 b8
>              ^
>
> The C++03 standard does "~ios::failbit" in 27.6.1.3/22, which suggests
> it's valid and clang is wrong.
>
> Is this a false positive?
>

No. This is gcc.gnu.org/PR56158
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130228/764c01ab/attachment.html>


More information about the cfe-dev mailing list