RFR: 8343506: [s390x] multiple test failures with ubsan
Dean Long
dlong at openjdk.org
Wed Nov 6 00:59:28 UTC 2024
On Tue, 5 Nov 2024 10:05:02 GMT, Martin Doerr <mdoerr at openjdk.org> wrote:
>> src/hotspot/cpu/s390/s390.ad line 2550:
>>
>>> 2548: // Unsigned Integer Immediate: 9-bit
>>> 2549: operand SSlenDW() %{
>>> 2550: predicate(Immediate::is_uimm8((julong)n->get_long()-1));
>>
>> Suggestion:
>>
>> predicate(n->get_long() >= 1 && Immediate::is_uimm8((julong)n->get_long()-1));
>
> I don't think this is necessary. Unsigned subtraction with wrap-around is not undefined behavior.
Right, it's not UB, but sometimes it is a bug, and would be flagged by things like -fsanitize=unsigned-integer-overflow, so my preference would be to avoid it if possible.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/21864#discussion_r1830259148
More information about the hotspot-compiler-dev
mailing list