Public bug reported:
This appears to be a regression from clang 6.0.0 to 6.0.1 (also reported
upstream: https://bugs.llvm.org/show_bug.cgi?id=37457).
The following code:
#include <stdatomic.h>
int main(int argc, char** argv) {
atomic_int tmp = ATOMIC_VAR_INIT(-1);
atomic_store_explicit(&tmp, 42, memory_order_relaxed);
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_store_explicit(&tmp, 42, memory_order_relaxed);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/bin/../lib/gcc/x86_64-linux-gnu/7.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.
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
ProcVersionSignature: Ubuntu 4.15.0-23.25-generic 4.15.18
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)
** Affects: llvm-toolchain-6.0 (Ubuntu)
Importance: Undecided
Status: New
** Tags: amd64 apport-bug cosmic
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1780747
Title:
Use of atomic_int now fails with address argument to atomic operation
must be a pointer to a trivially-copyable type
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/llvm-toolchain-6.0/+bug/1780747/+subscriptions
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs