aboutsummaryrefslogtreecommitdiff
path: root/libatomic/tas_n.c
AgeCommit message (Collapse)AuthorFilesLines
2022-03-24[libatomic] Fix return value in libat_test_and_setTom de Vries1-1/+1
On nvptx (using a Quadro K2000 with driver 470.103.01) I ran into this: ... FAIL: gcc.dg/atomic/stdatomic-flag-2.c -O1 execution test ... which mimimized to: ... #include <stdatomic.h> atomic_flag a = ATOMIC_FLAG_INIT; int main () { if ((atomic_flag_test_and_set) (&a)) __builtin_abort (); return 0; } ... The atomic_flag_test_and_set is implemented using __atomic_test_and_set_1, which corresponds to the "word-sized compare-and-swap loop" version of libat_test_and_set in libatomic/tas_n.c. The semantics of a test-and-set is that the return value is "true if and only if the previous contents were 'set'". But the code uses: ... return woldval != 0; ... which means it doesn't look only at the byte that was either set or not set, but at the entire word. Fix this by using instead: ... return (woldval & ((UTYPE) ~(UTYPE) 0 << shift)) != 0; ... Tested on nvptx. libatomic/ChangeLog: 2022-03-24 Tom de Vries <tdevries@suse.de> PR target/105011 * tas_n.c (libat_test_and_set): Fix return value.
2022-01-03Update copyright years.Jakub Jelinek1-1/+1
2021-01-04Update copyright years.Jakub Jelinek1-1/+1
2020-01-01Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r279813
2019-01-01Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r267494
2018-01-03Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r256169
2017-01-01Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r243994
2016-01-04Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r232055
2015-01-05Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r219188
2014-01-02Update copyright years in libatomic/Richard Sandiford1-1/+1
From-SVN: r206291
2013-01-14Update copyright years in libatomic.Richard Sandiford1-1/+1
From-SVN: r195164
2012-05-22re PR other/53231 (libatomic/tas_n.c:100:10: error: 'ret' undeclared (first ↵John David Anglin1-2/+2
use in this function)) PR other/53231 * tas_n.c (libat_test_and_set): Correct return. Remove unused variable. From-SVN: r187783
2012-05-01Add libatomic as a target library.Richard Henderson1-0/+115
From-SVN: r187018