https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111726

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #1)
> I am not 100% sure but since _M_initialize does not use signgam, this is
> just 2 writes to a global variable that will not be read so the data write
> race is 100% ok.

This example might not misbehave (even though it's technically UB) but if
somebody constructs a std::poisson_distribution in one thread and use lgamma in
another thread, the lgamma call might get the wrong result.

So in the general case, this data race can cause incorrect results (as well as
being UB).

Reply via email to