<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - Use of _Atomic() now fails with address argument to atomic operation must be a pointer to a trivially-copyable type"
href="https://bugs.llvm.org/show_bug.cgi?id=37457">37457</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Use of _Atomic() now fails with address argument to atomic operation must be a pointer to a trivially-copyable type
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>6.0
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>release blocker
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Frontend
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>jgunthorpe@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>This must have become broken in the last few days, as we have a CI tracking the
APT packages for trusty of clang-5.0 which worked up until very recently.
It works fine in clang release 5.0.2, 6.0.0, gcc-7, etc.
Test case:
#include <stdatomic.h>
int main(int argc,const char *argv[])
{
int tmp;
atomic_store_explicit((_Atomic(int) *)&tmp, 0, memory_order_relaxed);
return 0;
}
$ clang-5.0 --version
clang version 5.0.2-svn328729-1~exp1~20180509123505.100 (branches/release_50)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
$ clang-5.0 -std=gnu11 -Wall t.c
t.c:6:9: error: address argument to atomic operation must be a pointer to a
trivially-copyable type ('_Atomic(int) *' invalid)
atomic_store_explicit((_Atomic(int) *)&tmp, 0, 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.
$ clang-6.0 --version
clang version 6.0.1-svn331815-1~exp1~20180510084719.80 (branches/release_60)
$ clang-6.0 -std=gnu11 -Wall t.c
t.c:6:9: error: address argument to atomic operation must be a pointer to a
trivially-copyable type ('_Atomic(int) *' invalid)
atomic_store_explicit((_Atomic(int) *)&tmp, 0, memory_order_relaxed);
While these work fine (official pre-compiled tar releases on ubuntu Xenial):
$ ./clang+llvm-5.0.2-x86_64-linux-gnu-ubuntu-16.04/bin/clang --version
clang version 5.0.2 (tags/RELEASE_502/final)
$ ./clang+llvm-5.0.2-x86_64-linux-gnu-ubuntu-16.04/bin/clang -std=gnu11 -Wall
t.c
$ ./clang+llvm-6.0.0-x86_64-linux-gnu-ubuntu-16.04/bin/clang --version
clang version 6.0.0 (tags/RELEASE_600/final)
$ ./clang+llvm-6.0.0-x86_64-linux-gnu-ubuntu-16.04/bin/clang -std=gnu11 -Wall
t.c</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>