mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 09:19:03 +00:00
AK: Add workaround for faulty Sanitizer warning on gcc 13+ in Atomic
gcc can't seem to figure out that the address of a member variable of AK::Atomic<u32> in AtomicRefCounted cannot be null when fetch_sub-ing. Add a bogus condition to convince the compiler that it can't be null.
This commit is contained in:
committed by
Andrew Kaster
parent
1c3f11a5a6
commit
913cffe928
@@ -279,7 +279,13 @@ public:
|
|||||||
|
|
||||||
ALWAYS_INLINE T fetch_sub(T val, MemoryOrder order = DefaultMemoryOrder) volatile noexcept
|
ALWAYS_INLINE T fetch_sub(T val, MemoryOrder order = DefaultMemoryOrder) volatile noexcept
|
||||||
{
|
{
|
||||||
return __atomic_fetch_sub(&m_value, val, order);
|
T volatile* ptr = &m_value;
|
||||||
|
// FIXME: GCC > 12 will wrongly warn on -Wstringop-overflow here with ASAN+UBSAN
|
||||||
|
#if defined(AK_COMPILER_GCC) && defined(HAS_ADDRESS_SANITIZER)
|
||||||
|
if (!ptr)
|
||||||
|
__builtin_unreachable();
|
||||||
|
#endif
|
||||||
|
return __atomic_fetch_sub(ptr, val, order);
|
||||||
}
|
}
|
||||||
|
|
||||||
ALWAYS_INLINE T operator&=(T val) volatile noexcept
|
ALWAYS_INLINE T operator&=(T val) volatile noexcept
|
||||||
|
|||||||
Reference in New Issue
Block a user