https://bugs.kde.org/show_bug.cgi?id=429864
Bug ID: 429864
Summary: s390x: C++ atomic test_and_set yields false-positive
memcheck diagnostics
Product: valgrind
Version: unspecified
Platform: Other
OS: Linux
Status: REPORTED
Severity: normal
Priority: NOR
Component: vex
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: ---
Running the following small test case under Valgrind memcheck on s390x yields
"conditional jump or move depends on uninitialised value(s)" messages:
#include <atomic>
int main (void)
{
std::atomic_flag af = ATOMIC_FLAG_INIT;
af.test_and_set(std::memory_order_acquire);
}
Valgrind complains about the compare-and-swap instruction CS, then again about
the conditional branch that retries the CS if necessary.
CS operates on an aligned word (4 bytes). It is emitted by the compiler here
even though the atomic variable is only 1 byte in this case. Consequently 3 of
the 4 bytes targeted by CS are uninitialized. However, the outcome of the CS
does *not* depend on the uninitialized bytes, because they are just compared
with copies of themselves. Thus these memcheck errors are false positives.
--
You are receiving this mail because:
You are watching all bug changes.