Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common Fix Sta...



details:   https://anonhg.NetBSD.org/src/rev/2fd3ed99fbbc
branches:  trunk
changeset: 374169:2fd3ed99fbbc
user:      hannken <hannken%NetBSD.org@localhost>
date:      Thu Apr 06 09:49:12 2023 +0000

description:
Fix StaticSpinMutex::CheckLocked() on sparc32.

The lock gets set with atomic_exchange() -> __sync_lock_test_and_set()
which sets the value to 255 instead of 1.  Check for a taken lock
with "!= 0" instead of "== 1".  This should work on all architectures.

Ok: Matthew Green

diffstat:

 external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_mutex.h |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diffs (12 lines):

diff -r 70568808dd03 -r 2fd3ed99fbbc external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_mutex.h
--- a/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_mutex.h    Thu Apr 06 04:44:08 2023 +0000
+++ b/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_mutex.h    Thu Apr 06 09:49:12 2023 +0000
@@ -39,7 +39,7 @@ class StaticSpinMutex {
   }
 
   void CheckLocked() {
-    CHECK_EQ(atomic_load(&state_, memory_order_relaxed), 1);
+    CHECK_NE(atomic_load(&state_, memory_order_relaxed), 0);
   }
 
  private:



Home | Main Index | Thread Index | Old Index