<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - invalid operations on forward iterators"
   href="https://bugs.llvm.org/show_bug.cgi?id=41345">41345</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>invalid operations on forward iterators
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>parallel STL
          </td>
        </tr>

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

        <tr>
          <th>Hardware</th>
          <td>All
          </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>New
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>ldionne@apple.com
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>zilla@kayari.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>There are several objects that are declared as _ForwardIterator but are used as
random access iterators e.g. in __internal::__remove_elements

    _DifferenceType __n = __last - __first;

and

                __calc_mask(__mask + __i, __mask + __j, __first + __i);

Similarly, __brick_reverse does this on _BidirectionalIterator objects:

    const auto __n = (__last - __first) / 2;


Those can be fixed by using std::distance and std::next, but there are other
uses of objects declared _ForwardIterator which are only valid for
bidirectional iterators e.g. in __pattern_unique:

    return remove_elements(
        std::forward<_ExecutionPolicy>(__exec), ++__first, __last,
        [&__pred, __is_vector](bool* __b, bool* __e, _ForwardIterator __it) {
            __brick_walk3(__b, __e, __it - 1, __it,

And several functions call __unseq_backend::__simd_walk_2 with _ForwardIterator
or _BidirectionalIterator arguments, when __simd_walk_2 assumes random access
iterators.

These are harder to fix.</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>