public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/96056] New: arm v6/v7: Missing acquire barrier for __atomic_compare_exchange(__ATOMIC_RELEASE, __ATOMIC_ACQUIRE)
@ 2020-07-04  8:09 izbyshev at ispras dot ru
  0 siblings, 0 replies; only message in thread
From: izbyshev at ispras dot ru @ 2020-07-04  8:09 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 96056
           Summary: arm v6/v7: Missing acquire barrier for
                    __atomic_compare_exchange(__ATOMIC_RELEASE,
                    __ATOMIC_ACQUIRE)
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: izbyshev at ispras dot ru
                CC: amonakov at gcc dot gnu.org
  Target Milestone: ---

$ cat test.c
void foo(int x, int y, int z) {
    __atomic_compare_exchange(&x, &y, &z, 0, __ATOMIC_RELEASE,
__ATOMIC_ACQUIRE);
}

$ arm-linux-gnueabi-gcc-10 -O2 -march=armv7 -S -o - test.c
[...]
        sub     sp, sp, #8
        str     r0, [sp, #4]
        add     r0, sp, #4
        dmb     ish
.L2:
        ldrex   r3, [r0]
        cmp     r3, r1
        bne     .L3
        strex   ip, r2, [r0]
        cmp     ip, #0
        bne     .L2
.L3:
        @ <=== missing dmb here
        add     sp, sp, #8
[...]

Changing __ATOMIC_RELEASE to __ATOMIC_ACQ_REL restores the missing barrier.

The same problem applies to armv6 as well.

I've checked that all GCC versions on gcc.godbolt.org since 5.4.0 behave in the
same way. All Clang versions on godbolt don't have this problem.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-07-04  8:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-04  8:09 [Bug target/96056] New: arm v6/v7: Missing acquire barrier for __atomic_compare_exchange(__ATOMIC_RELEASE, __ATOMIC_ACQUIRE) izbyshev at ispras dot ru

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).