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

Martin Doerr mdoerr at openjdk.org
Fri Nov 22 11:57:16 UTC 2024


On Fri, 22 Nov 2024 05:12:55 GMT, Amit Kumar <amitkumar at openjdk.org> wrote:

>> This PR converts datatype from `jint` to `juint` for contstant `c` check in c1_LIRGenerator_<arch>.cpp. Please look JBS for more info.
>
> Amit Kumar has updated the pull request incrementally with four additional commits since the last revision:
> 
>  - reduce diff size
>  - arm changes
>  - aarch64 changes
>  - s390x changes

Looks correct. Doing the cast only once may be better. I have seen a C2 test which covers such cases: test/hotspot/jtreg/compiler/c2/TestSerialAdditions.java
Are we testing these cases with C1, too?

src/hotspot/cpu/arm/c1_LIRGenerator_arm.cpp line 341:

> 339:     __ add(left, LIR_OprFact::address(addr), result); // add with shifted register
> 340:     return true;
> 341:   } else if(c == -1) {

Missing whitespace before "(".

src/hotspot/cpu/s390/c1_LIRGenerator_s390.cpp line 244:

> 242:   }
> 243: 
> 244:   if(c == -1) {

Missing whitespace before "(".

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

Marked as reviewed by mdoerr (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/22144#pullrequestreview-2454176032
PR Review Comment: https://git.openjdk.org/jdk/pull/22144#discussion_r1853754521
PR Review Comment: https://git.openjdk.org/jdk/pull/22144#discussion_r1853754012


More information about the hotspot-compiler-dev mailing list