https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90384
Bug ID: 90384 Summary: std::transform fails to apply to all elements Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: mfdeakin at cs dot unc.edu Target Milestone: --- The following minimal reproducer fails randomly when using the par and par_unseq execution policies, but passes when using the seq or just the default transform. (I don't know how to tag the following as code) #include <algorithm> #include <execution> #include <assert.h> int main(int argc, char **argv) { constexpr int size = 1024; std::vector<double> v(size); for (int i = 0; i < size; i++) { const double value = static_cast<double>(i); v[i] = value * value + 5.0 * value; } constexpr double min_v = 1000000.0; std::vector<bool> transform_par(size); std::transform(std::execution::par, v.begin(), v.end(), transform_par.begin(), [](const double v) { return v >= min_v; }); std::vector<bool> transform_seq(size); std::transform(std::execution::seq, v.begin(), v.end(), transform_seq.begin(), [](const double v) { return v >= min_v; }); auto [seq_diff, par_diff] = std::mismatch(transform_seq.begin(), transform_seq.end(), transform_par.begin(), transform_par.end()); assert(seq_diff == transform_seq.end()); assert(par_diff == transform_par.end()); return 0; } This is with the version of the parallel stl included with GCC 9.1. My GCC version is 9.1.1 20190503 (Red Hat 9.1.1-1). My version of tbb is tbb-devel-2019.5-1.fc30.x86_64, which I believe is just the latest release, 2019 update 5.