> From: Mattias Rönnblom [mailto:mattias.ronnb...@ericsson.com] > Sent: Sunday, 13 October 2024 13.57 > > The macros generating the parallel test for atomic test-and- > [set|clear|flip] functions used a 64-bit reference word when assuring > no neighbouring bits were modified, even when generating code for the > 32-bit version of the test. > > This issue causes spurious test failures on GCC 12.2.0 (the default > compiler on for example Debian 12 "bookworm"), when optimization level > 2 or higher are used. > > The test failures do not occur with GCC 11, 12.3 and 13.2. > > To the author, this looks like a promotion-related compiler bug in GCC > 12.2.
I am curious about the compiler bug... Did the bug occur when the most significant bit was set, so it sign related? Maybe this will reveal something: TEST_ASSERT(expected_word == word, "Untouched bits have changed value, %" PRIx ## size " should be %" PRIx64, word, expected_word); > > Fixes: 35326b61aecb ("bitops: add atomic bit operations in new API") > > Signed-off-by: Mattias Rönnblom <mattias.ronnb...@ericsson.com> > --- I took a deep look into this. Regardless of what the compiler bug is, Reviewed-by: Morten Brørup <m...@smartsharesystems.com>