http://llvm.org/bugs/show_bug.cgi?id=19663

            Bug ID: 19663
           Summary: bitset ++operator generates invalid end
           Product: libc++
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    Classification: Unclassified

The following program fails with an assertion:

#include <vector>
#include <cassert>
#include <algorithm>

int main()
{
    std::vector<bool> bits;
    bits.resize(6 * 64, false);
    const size_t thePlace = 375;
    const size_t start = thePlace + 1;
    bits[thePlace] = true;
    std::vector<bool>::iterator i = std::find(bits.begin() + start, bits.end(),
true);
    assert(i == bits.end());
    return i - bits.begin();
}


The expected result is that i should equal end(). It only fails when the bit
vector size is a whole multiple of the word size (64 bit for me).

Looking at i, what surprised me a bit is that __ctz_ (the bit in the word
pointed to) is 64, while for end() it's 0. I suspect that the ++operator
produces the wrong value for "the end" in this case.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to