Re: [PATCH] riscv/futex: sign extend compare value in atomic cmpxchg
From: Andreas Schwab
Date: Tue Feb 04 2025 - 03:28:31 EST
On Feb 03 2025, Jessica Clarke wrote:
> On 3 Feb 2025, at 10:06, Andreas Schwab <schwab@xxxxxxx> wrote:
>>
>> Make sure the compare value in the lr/sc loop is sign extended to match
>> what lr.w does. Fortunately, due to the compiler keeping the register
>> contents sign extended anyway the lack of the explicit extension didn't
>> result in wrong code so far, but this cannot be relied upon.
>
> GCC may guarantee this today,
It doesn't, that's the point!
--
Andreas Schwab, SUSE Labs, schwab@xxxxxxx
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."