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

--- Comment #4 from Michal Zientkiewicz <michalz at nvidia dot com> ---
The problem is that the order of destruction is incorrect if there's a race
condition.
Consider 2 threads initializing static variables S1 and S2:

Thread A             Thread B

acquire
construct S1
release
                     acquire
                     construct S2
                     release
                     atexit destroy S2
atexit destroy S1

Construction order:
S1 S2

Destruction order:
S1 S2

Should be
S2 S1


The demo program triggers that behavior (not always, of course, but frequently
enough to see it fail in say, 10 runs).

Reply via email to