[LLVMbugs] [Bug 12456] New: clang++ won't compile code using atomis with libstdc++ 4.7.0

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Apr 3 22:08:12 PDT 2012


http://llvm.org/bugs/show_bug.cgi?id=12456

             Bug #: 12456
           Summary: clang++ won't compile code using atomis with libstdc++
                    4.7.0
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: release blocker
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: llvm-bugs at quasiparticle.net
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Another report (#11916) already mentions that clang++ fails with libstdc++
4.7.0 in cmath and a few other headers. The list of broken headers need to be
expanded though to include everything that transitively uses atomics. Affected
headers are, among others, <memory> and <iostream>.

An example program that merely includes <memory> fail to compile with the
following error output:

In file included from bar.cpp:1:
In file included from
/usr/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/memory:74:
/usr/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/ext/atomicity.h:48:12:
error: first argument to atomic operation must be a pointer to _Atomic
      type ('volatile _Atomic_word *' (aka 'volatile int *') invalid)
  { return __atomic_fetch_add(__mem, __val, __ATOMIC_ACQ_REL); }
           ^                  ~~~~~
/usr/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/ext/atomicity.h:52:5:
error: first argument to atomic operation must be a pointer to _Atomic type
      ('volatile _Atomic_word *' (aka 'volatile int *') invalid)
  { __atomic_fetch_add(__mem, __val, __ATOMIC_ACQ_REL); }
    ^                  ~~~~~
In file included from bar.cpp:1:
In file included from
/usr/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/memory:86:
In file included from
/usr/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/bits/shared_ptr.h:52:
/usr/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/bits/shared_ptr_base.h:247:15:
error: use of undeclared identifier '__atomic_compare_exchange_n'
      while (!__atomic_compare_exchange_n(&_M_use_count, &__count, __count + 1,
              ^
3 errors generated.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list