Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

false positive uninit reads in recent clang std::vector<bool> #1666

Open
derekbruening opened this issue Jan 4, 2015 · 1 comment
Open

Comments

@derekbruening
Copy link
Contributor

It looks like recent clang:
Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn)
is using bitvectors for std::vector and they thwart DrMem's bit
handling.

~~Dr.M~~ Error #1: UNINITIALIZED READ: reading register esi
~~Dr.M~~ # 0 Board::getHorizontalWall               [/Applications/Xcode.app/Contents/Developer/Too\
lchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__bit_reference:145]
~~Dr.M~~ # 1 Board::moveRobot                       [board_solution.cpp:226]
~~Dr.M~~ # 2 TryAllMoveSequences                    [main_solution.cpp:208]
~~Dr.M~~ # 3 main                                   [main_solution.cpp:295]

Zooming in on the code involved:

    while (getHorizontalWall(location.row+0.5,location.col) == false &&
           getspot(Position(location.row+1,location.col)) == ' ') {

  horizontal_walls = std::vector<std::vector<bool> >(rows+1,std::vector<bool>(cols,false));

  return horizontal_walls[floor(r)][c-1];

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c\
++/v1/__bit_reference:145
    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR operator bool() const _NOEXCEPT                     
        {return static_cast<bool>(*__seg_ & __mask_);}

So this C++ lib is taking vector and squishing it into a bit array.

I have yet to construct a small reproducer (unless I turn on -strict_bitops).

@derekbruening
Copy link
Contributor Author

Xref issue #1451

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant