Bug#903709: clang-6.0: Includes gcc's stdatomics.h

Kurt Roeckx kurt at roeckx.be
Wed Aug 15 14:16:20 BST 2018


Hi,

There seem to be many reports like this, going back years. But I
don't see the problem with clang-5.0, but I do with clang-6.0.
I've read somewhere that this might be some regression between
6.0.0 and 6.0.1, but I'm not sure about it.

Anyway, I also get:
include/internal/refcount.h:34:12: error: address argument to atomic operation must be a pointer to integer or pointer ('_Atomic(int) *' invalid)
    *ret = atomic_fetch_add_explicit(val, 1, memory_order_relaxed) + 1;
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/include/stdatomic.h:195:6: note: expanded from macro 'atomic_fetch_add_explicit'
                          __atomic_fetch_add ((PTR), (VAL), (MO))
                          ^                   ~~~~~

The problem is that clang includes gcc's stdatmics.h, and gcc's
header file uses gcc extentions to remove the atomic qualifier and
clang doesn't support that.

>From what I understand, including gcc's headers was a workaround
for a bug that is now fixed.

I think the most relevant upstream bug for this is:
https://bugs.llvm.org/show_bug.cgi?id=23556
https://bugs.llvm.org/show_bug.cgi?id=22740


Kurt



More information about the Pkg-llvm-team mailing list