Merge pull request #655 from Ragora/bugfix-asan-sync-fetch-and-add

BugFix: Correct an ASAN reported memory error caused by incorrect usage of __sync_fetch_and_add
This commit is contained in:
Brian Roberts 2021-11-03 21:17:07 -05:00 committed by GitHub
commit 1a0b66b5e3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -79,7 +79,7 @@ inline bool dCompareAndSwap( volatile U64& ref, U64 oldVal, U64 newVal )
inline U32 dAtomicRead( volatile U32 &ref )
{
#if !defined(TORQUE_OS_MAC)
return __sync_fetch_and_add( ( volatile long* ) &ref, 0 );
return __sync_fetch_and_add( &ref, 0 );
#else
return OSAtomicAdd32( 0, (int32_t* ) &ref);
#endif