<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - bitset ++operator generates invalid end"
   href="http://llvm.org/bugs/show_bug.cgi?id=19663">19663</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>bitset ++operator generates invalid end
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libc++
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>All Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>Erik.Verbruggen@Me.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu, mclow.lists@gmail.com
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>