[llvm-bugs] [Bug 26911] New: atomic types not trivially-copyable when clang targets mingw-w64

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Mar 10 23:42:54 PST 2016


https://llvm.org/bugs/show_bug.cgi?id=26911

            Bug ID: 26911
           Summary: atomic types not trivially-copyable when clang targets
                    mingw-w64
           Product: clang
           Version: 3.8
          Hardware: PC
                OS: Windows XP
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: jibz-llvmbugs at stdip.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

The following code:

#include <stdatomic.h>
atomic_int foo;
void store(int val)
{
    atomic_store(&foo, val);
}

fails when compiled with clang using mingw-w64 (GCC 5.3.0) headers with:

foo.c:5:2: error: address argument to atomic operation must be a pointer to
      a trivially-copyable type ('_Atomic(int) *' invalid)
        atomic_store(&foo, val);
        ^~~~~~~~~~~~~~~~~~~~~~~
C:\mingw64\mingw64\lib\gcc\x86_64-w64-mingw32\5.3.0\include\stdatomic.h:130:3:
note:
      expanded from macro 'atomic_store'
  atomic_store_explicit (PTR, VAL, __ATOMIC_SEQ_CST)
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\mingw64\mingw64\lib\gcc\x86_64-w64-mingw32\5.3.0\include\stdatomic.h:126:5:
note:
      expanded from macro 'atomic_store_explicit'
    __atomic_store (__atomic_store_ptr, &__atomic_store_tmp, (MO));     \
    ^               ~~~~~~~~~~~~~~~~~~
1 error generated.

I tried both the official installer using --target=x86_64-w64-mingw32 to target
my mingw-w64 install, and using clang in MSYS2 which targets their GCC.

Near line 126 of stdatomic.h, there is a comment about these macros expecting
__typeof__ and __auto_type to remove _Atomic specifier. If I make foo a regular
int it compiles.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160311/a7c73fbf/attachment-0001.html>


More information about the llvm-bugs mailing list