Use of atomic_int now fails with address argument to atomic operation must be a pointer to a trivially-copyable type
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
llvm-toolchain-6.0 (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
This appears to be a regression from clang 6.0.0 to 6.0.1 (also reported upstream: https:/
The following code:
#include <stdatomic.h>
int main(int argc, char** argv) {
atomic_int tmp = ATOMIC_
atomic_
return 0;
}
fails to build:
$ clang-6.0 -std=gnu11 -Wall test.c
test.c:7:3: error: address argument to atomic operation must be a pointer to a trivially-copyable type ('_Atomic(int) *' invalid)
atomic_
^~~~~
/usr/bin/
__atomic_store (__atomic_
^ ~~~~~~~~~~~~~~~~~~
1 error generated.
If I replace "atomic_int" by "int", the code builds and works as expected.
ProblemType: Bug
DistroRelease: Ubuntu 18.10
Package: clang-6.0 1:6.0.1-2ubuntu1
ProcVersionSign
Uname: Linux 4.15.0-23-generic x86_64
ApportVersion: 2.20.10-0ubuntu3
Architecture: amd64
CurrentDesktop: ubuntu:GNOME
Date: Mon Jul 9 10:33:31 2018
InstallationDate: Installed on 2018-07-06 (2 days ago)
InstallationMedia: Ubuntu 18.10 "Cosmic Cuttlefish" - Alpha amd64 (20180630)
SourcePackage: llvm-toolchain-6.0
UpgradeStatus: No upgrade log present (probably fresh install)
In /usr/lib/ gcc/x86_ 64-linux- gnu/7.3. 0/include/ stdatomic. h, before the definition of the atomic_ store_explicit macro:
Note that these macros require __typeof__ and __auto_type to remove
_Atomic qualifiers (and const qualifiers, if those are valid on
macro operands).
It looks like the regression might be that __auto_type doesn't remove the _Atomic qualifier any longer?