math: boost::math::gamma_q fails with OpenMP

Testcase: boost.cpp.txt

It computes values of boost::math::gamma_q wrong when run in parallel with OpenMP:

$ c++  -I /usr/local/include/ boost.cpp -std=c++17 -fopenmp
$ ./a.out 
ncpu=0
fail@200: 0.603301!=0.596038

boost-libs-1.80.0_1 OS: FreeBSD 13.1

About this issue

Most upvoted comments

I’m happy to reopen, but someone is going to have to give us clue here as the thread sanitizer messages are all from OpenMP’s own runtime. If I get time later I’ll try and extract a few fragments of the incomplete gamma and perhaps someone can see if any of those still trigger the issue?