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

--- Comment #9 from Ivan Bodrov <securesneakers at gmail dot com> ---
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 variable can be excluded
and the waiter code can be replaced with unlock-then-lock:

    mutex_lock(&mtx);
    while (!val) {
        mutex_unlock(&mtx);
        mutex_lock(&mtx);
    }
    mutex_unlock(&mtx);

This might be a better demonstration. Will hang the same way for the same
reason:

    $ gcc -O2 minimal-executable-no-cond.c
    $ ./a.out

Reply via email to