Source-Changes archive

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

CVS commit: src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common



Module Name:    src
Committed By:   riastradh
Date:           Fri Apr 18 23:30:27 UTC 2025

Modified Files:
        src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common:
            sanitizer_mutex.h

Log Message:
libubsan: Don't assume __sync_lock_test_and_set(&v, 1) sets v to 1.

It may set v to some other nonzero value, as documented by gcc:

> Many targets have only minimal support for such locks, and do not
> support a full exchange operation.  In this case, a target may
> support reduced functionality here by which the only valid value to
> store is the immediate constant 1.  The exact value actually stored
> in *ptr is implementation defined.

https://gcc.gnu.org/onlinedocs/gcc-10.5.0/gcc/_005f_005fsync-Builtins.html

(Actually, I'm not even sure it's guaranteed to be nonzero -- on hppa
with LDCW (load and clear word), the obvious choice would be zero for
locked and nonzero for locked.  But currently gcc doesn't take
advantage of that on hppa.)

With this, we will end our long tradition of having the releng sparc
testbed spend several hours in every test run spinning to obtain a
lock it already holds in order to report a `lock held' assertion
failure that tripped because it assumed __sync_lock_test_and_set
would store 1 and not 0xff -- a tradition we have carried on firmly
for the last seven years (less a couple weeks) since these t_ubsan_*
tests were first committed.

PR port-sparc/53277: Many ubsan tests fail on sparc


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
    src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_mutex.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.




Home | Main Index | Thread Index | Old Index