RFR: 8344026: Ubsan: prevent potential integer overflow in c1_LIRGenerator_<arch>.cpp file [v8]

Amit Kumar amitkumar at openjdk.org
Wed Dec 4 10:06:42 UTC 2024


On Wed, 4 Dec 2024 09:34:55 GMT, Martin Doerr <mdoerr at openjdk.org> wrote:

>> And do you have some sort of tests for this, to make sure we check with all possible `c` values?
>
>> What happens if this underflows? Is this not undefined behaviour? Could we use `java_add`?
> 
> Unsigned subtraction is never undefined. "wrap around" behavior is used. Using `java_add` / `java_subtract` sounds like a good idea.

>And do you have some sort of tests for this, to make sure we check with all possible c values?

No, as of now I only ran tier1 test cases with c1 compiler. Nothing else.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/22144#discussion_r1869114193


More information about the hotspot-compiler-dev mailing list