<html>
<head>
<base href="https://llvm.org/bugs/" />
</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 --- - 4.0/trunk regression: after r291477, incorrect _GCC_ATOMIC_LLONG_LOCK_FREE values on i386-freebsd"
href="https://llvm.org/bugs/show_bug.cgi?id=31864">31864</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>4.0/trunk regression: after r291477, incorrect _GCC_ATOMIC_LLONG_LOCK_FREE values on i386-freebsd
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</td>
</tr>
<tr>
<th>Version</th>
<td>4.0
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</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>new bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>dimitry@andric.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>In r291477, some long-standing inconsistencies with
__GCC_ATOMIC_LLONG_LOCK_FREE were fixed, solving <a class="bz_bug_link
bz_status_NEW "
title="NEW --- - __GCC_ATOMIC_LLONG_LOCK_FREE only set to 1 on X86"
href="show_bug.cgi?id=19355">bug 19355</a>
(__GCC_ATOMIC_LLONG_LOCK_FREE only set to 1 on X86) and <a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED FIXED - Inconsistent value of ATOMIC_LLONG_LOCK_FREE vs __atomic_always_lock_free(sizeof(long long), 0) on 32-bit x86"
href="show_bug.cgi?id=30581">bug 30581</a> (Inconsistent
value of ATOMIC_LLONG_LOCK_FREE vs __atomic_always_lock_free(sizeof(long long),
0) on 32-bit x86).
However, this fix has the unfortunate side effect of making the value of
__GCC_ATOMIC_LLONG_LOCK_FREE incorrect on 32-bit FreeBSD, e.g. the
i386-unknown-freebsd target. This is because 32-bit FreeBSD defaults to
targeting i486, not i686 like most Linuxes:
$ uname -srm
FreeBSD 12.0-CURRENT i386
$ gcc -dM -E -x c /dev/null | grep LLONG_LOCK
#define __GCC_ATOMIC_LLONG_LOCK_FREE 1
$ clang-3.9.1 -dM -E -x c /dev/null | grep LLONG_LOCK
#define __GCC_ATOMIC_LLONG_LOCK_FREE 1
$ clang-4.0.0 -dM -E -x c /dev/null | grep LLONG_LOCK
#define __GCC_ATOMIC_LLONG_LOCK_FREE 2
As I mentioned in <a href="https://reviews.llvm.org/D28213">https://reviews.llvm.org/D28213</a>, the value of
__GCC_ATOMIC_LLONG_LOCK_FREE is now still incorrect, even on Linux, if you
target i486:
$ uname -srm
Linux 3.16.0-4-686-pae i686
$ gcc -dM -E -x c /dev/null | grep LLONG_LOCK
#define __GCC_ATOMIC_LLONG_LOCK_FREE 2
$ gcc -march=i486 -dM -E -x c /dev/null | grep LLONG_LOCK
#define __GCC_ATOMIC_LLONG_LOCK_FREE 1
It turns out that this has been broken since quite some time (r142002, to be
exact), as tools/clang/lib/Basic/Targets.cpp has this comment:
X86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
: X86TargetInfo(Triple, Opts) {
[...]
// x86-32 has atomics up to 8 bytes
// FIXME: Check that we actually have cmpxchg8b before setting
// MaxAtomicInlineWidth. (cmpxchg8b is an i586 instruction.)
MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 64;
We need to either fix this constructor to assign the correct max atomic inline
width for the target (either via the triple or via -march=), or r291477 must be
reverted.</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>