<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 - mips stdatomic.h usage includes gcc headers (and fails)"
href="https://bugs.llvm.org/show_bug.cgi?id=48623">48623</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>mips stdatomic.h usage includes gcc headers (and fails)
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>11.0
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>MacOS X
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Driver
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>saurik@saurik.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>There have been a number of issues filed that are similar to this over the
years, notably including #22740. This issue was considered fixed a long time
ago, and in fact I generally can't replicate it... except when compiling for
MIPS (which I'm doing using a sysroot based on Debian Stretch).
#include <stdatomic.h>
static inline void CRYPTO_UP_REF(_Atomic int *val, int *ret, void *lock) {
*ret = atomic_fetch_add_explicit(val, 1, memory_order_relaxed) + 1; }
/usr/local/opt/llvm/bin/clang --sysroot
/Users/saurik/orchid/cli-shared/out-wrt/sysroot -target mips-linux-gnu -c -o
test.o test.c -v
clang -cc1 version 11.0.0 based upon LLVM 11.0.0 default target
x86_64-apple-darwin18.7.0
ignoring nonexistent directory
"/Users/saurik/orchid/cli-shared/out-wrt/sysroot/usr/local/include"
ignoring nonexistent directory
"/Users/saurik/orchid/cli-shared/out-wrt/sysroot/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/Cellar/llvm/11.0.0/lib/clang/11.0.0/include
/Users/saurik/orchid/cli-shared/out-wrt/sysroot/usr/lib/gcc/mips-linux-gnu/6/include
/Users/saurik/orchid/cli-shared/out-wrt/sysroot/usr/include/mips-linux-gnu
/Users/saurik/orchid/cli-shared/out-wrt/sysroot/usr/include
End of search list.
test.c:3: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; }
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/saurik/orchid/cli-shared/out-wrt/sysroot/usr/lib/gcc/mips-linux-gnu/6/include/stdatomic.h:195:6:
note: expanded from macro 'atomic_fetch_add_explicit'
__atomic_fetch_add ((PTR), (VAL), (MO))
^ ~~~~~
1 error generated.</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>