1
Vote

set_symmetric_difference, set_union par/vec is returning wrong results

description

Repro:
#include <experimental/algorithm>
#include <iostream>

int main()
{
    using std::experimental::parallel::par;
    using std::experimental::parallel::seq;

    int A[] = {1, 3};
    int B[] = {0, 2, 4};

    {
        int C[10];
        int* end = set_symmetric_difference(seq, std::begin(A), std::end(A),
            std::begin(B), std::end(B), std::begin(C));
        std::copy(C, end, std::ostream_iterator<int>(std::cout, " "));
        std::cout << std::endl;
    }
    {
        int C[10];
        int* end = set_symmetric_difference(par, std::begin(A), std::end(A),
            std::begin(B), std::end(B), std::begin(C));
        std::copy(C, end, std::ostream_iterator<int>(std::cout, " "));
        std::cout << std::endl;
    }
}
Expected: Same results from seq and par -- 0 1 2 3 4
Actual: seq is correct, par less so:
0 1 2 3 4
0 1 3 4
Identical issue affects set_union.

comments