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

Sean McBride sean at rogue-research.com
Thu Feb 28 11:36:22 PST 2013


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?

Thanks,

-- 
____________________________________________________________
Sean McBride, B. Eng                 sean at rogue-research.com
Rogue Research                        www.rogue-research.com 
Mac Software Developer              Montréal, Québec, Canada






More information about the cfe-dev mailing list