https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115802
--- Comment #9 from Ivan Bodrov ---
Created attachment 58598
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58598&action=edit
Minimal program to reproduce the issue (no condvar)
To further simplify the original code, the condition variabl
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115802
--- Comment #8 from Ivan Bodrov ---
The 2nd example is only intended to show changes in code generation after the
fence is moved to the function that is visible, but is not inlined, which is
the cause of this issue. The code is not supposed to
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115802
--- Comment #6 from Ivan Bodrov ---
Created attachment 58597
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58597&action=edit
Smaller, but non runnable example.
Full demo code for the above (can't be run, only shows code generation). Can
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115802
--- Comment #5 from Ivan Bodrov ---
Without the mutex threads would race for the first access to non-atomic
variable.
Seq-Cst ordering is only used to simplify the example, it can be relaxed to
acquire/release/relaxed for different operations.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115802
--- Comment #3 from Ivan Bodrov ---
Yes, but "wait" operation is not supposed to touch anything.
The example shows typical usage of condition variable, except "real" code
usually accesses data through some pointer, not as a static variable. Or
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115802
Bug ID: 115802
Summary: Non-atomic load of static variable moved out of loop
despite atomic fences
Product: gcc
Version: 14.1.1
Status: UNCONFIRMED
Severity: n
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110184
--- Comment #3 from Ivan Bodrov ---
Created attachment 56646
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56646&action=edit
Fails to apply optimization for __atomic_fetch_and ZF-flag with separate
literals
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110184
Ivan Bodrov changed:
What|Removed |Added
CC||securesneakers at gmail dot com
--- Comme