mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-31 05:09:12 +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:
parent
1c3f11a5a6
commit
913cffe928
Notes:
sideshowbarker
2024-07-17 08:42:05 +09:00
Author: https://github.com/ADKaster
Commit: 913cffe928
Pull-request: https://github.com/SerenityOS/serenity/pull/23077
Reviewed-by: https://github.com/BertalanD
Reviewed-by: https://github.com/trflynn89 ✅
1 changed files with 7 additions and 1 deletions
|
@ -279,7 +279,13 @@ public:
|
|||
|
||||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue