Hello!

When run in helgrind, the C++ example programs at

    en.cppreference.com/w/cpp/atomic/atomic_flag

and

    www.cplusplus.com/reference/atomic/atomic_flag/

report a bunch of possible data races. For instance,

    ==24483== Possible data race during read of size 1 at 0x6051F1 by
    thread #3
    ==24483== Locks held: none
    ==24483==    at 0x400E8F: test_and_set (atomic_base.h:176)
    ==24483==    by 0x400E8F: f(int) (helgrind_spinlock2.cpp:11)
    ...
    ==24483== This conflicts with a previous write of size 1 by thread
    #2
    ==24483== Locks held: none
    ==24483==    at 0x400EE6: clear (atomic_base.h:193)
    ==24483==    by 0x400EE6: f(int) (helgrind_spinlock2.cpp:14)

Is it correct to conclude that these are false positives? I found a
lot of discussion in the mailing list on atomic operations but nothing
"recent" seemed to address the C++ standard library.

regards
john perry

-- 
John Perry, PhD + Associate Professor of Mathematics
Undergraduate Program Lead, Mathematics BS
University of Southern Mississippi
School of Physical and Metaphysical Sciences
(i.e., School of Mathematics and Natural Sciences)


Contrariwise, if it was so, it might be, and if it were so, it would
be, but as it isn't, it ain't. That's logic. -- Tweedledee, Through the
Looking Glass


_______________________________________________
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to