https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113772
Bug ID: 113772
Summary: [14 Regression] atomic.d compile error since recent
upstream imports.
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Keywords: build
Severity: normal
Priority: P3
Component: d
Assignee: ibuclaw at gdcproject dot org
Reporter: iains at gcc dot gnu.org
Target Milestone: ---
Target: powerpc64-linux, powerpc-darwin
I am now seeing this on both Darwin and Linux BE powerpc.
The message is somewhat odd, since AFAICS from the core druntime code that
pulls in builtins.def which pulls in sync-builtins.def - which defines this
builtin.
If I check the C compiler manually, then the builtin works as expected - inline
for 1,2,4 bytes and out-of-line call to the atomic library for 8+ (32b PPC).
=====
/home/iains/gcc-master/src/libphobos/libdruntime/core/internal/atomic.d:612:53:
error: cannot evaluate unimplemented builtin ‘__atomic_is_lock_free’ at compile
time
612 | enum IsAtomicLockFree(T) = __atomic_is_lock_free(T.sizeof, null);
| ^
../../../../../src/libphobos/libdruntime/core/stdc/stdatomic.d:65:30: error:
template instance ‘core.internal.atomic.IsAtomicLockFree!ulong’ error
instantiating
65 | ATOMIC_LLONG_LOCK_FREE = IsAtomicLockFree!ulong ? 2 : 0,
======
I wonder if that enum should also be guarded by
"static if (GNU_Have_Atomics || GNU_Have_LibAtomic)"
although that ought to make no difference since both the platforms mentioned
have support for libatomic.
-------
work-around:
version (PPC)
{
enum IsAtomicLockFree(T) = T.sizeof <= 4;
}
else
{
enum IsAtomicLockFree(T) = __atomic_is_lock_free(T.sizeof, null);
}