https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66326
ryan.burn at gmail dot com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ryan.burn at gmail dot com --- Comment #4 from ryan.burn at gmail dot com --- I'm getting a similar problem testing with 6.0. Only the flags -mfpmath doesn't seem to make a difference for the case I'm testing. But it runs successfully with -O1 or above but fails with -O0. Not sure which particular option is causing the problem. Here's the code I'm testing with /////////////////////////////////////////////////////////////////////////// #include <cilk/cilk.h> #include <vector> #include <random> template <class T> void do_not_optimize_away(T&& x) { asm volatile("" : "+r"(x)); } const int N = 1'000'000; auto compute() { std::vector<double> v(N); auto rng = std::mt19937{std::random_device{}()}; std::uniform_real_distribution<double> dist(0, 1); for (int i = 0; i < N; ++i) v[i] = std::log(std::sqrt(dist(rng))); return v; } int main() { std::vector<double> v1, v2, v3; cilk_spawn [&] { v1 = compute(); }(); cilk_spawn [&] { v2 = compute(); }(); v3 = compute(); do_not_optimize_away(v1.data()); do_not_optimize_away(v2.data()); do_not_optimize_away(v3.data()); return 0; } /////////////////////////////////////////////////////////////////////////// // O1 level - good rnburn@localhost ~/test/gcc_cilk $ /home/rnburn/local/bin/g++ -std=c++1z -O1 -fcilkplus -std=c++14 -march=haswell t2.cpp rnburn@localhost ~/test/gcc_cilk $ ./a.out // O0 level - fails rnburn@localhost ~/test/gcc_cilk $ /home/rnburn/local/bin/g++ -std=c++1z -O0 -fcilkplus -std=c++14 -march=haswell t2.cpp rnburn@localhost ~/test/gcc_cilk $ ./a.out Floating point exception