RFR: 8374436: compiler/igvn/IntegerDivValueTests.java failed with division by zero
Tobias Hotz
duke at openjdk.org
Tue Jan 6 18:30:06 UTC 2026
On Tue, 6 Jan 2026 15:34:06 GMT, Emanuel Peter <epeter at openjdk.org> wrote:
>> This PR is a follow-up to https://github.com/openjdk/jdk/pull/26143
>> I've missed that INT_CONST_2 and LONG_CONST_2 may be zero depending on the seed, which causes arithmetic exceptions that are not being caught.
>> The fix is simple: Detect if these constants are zero, and if so, expect a div by zero exception to be thrown.
>> I've not added additional test as this is a testbug, but I verified this test works correctly now if INT_CONST_2 is zero
>
> test/hotspot/jtreg/compiler/igvn/IntegerDivValueTests.java line 207:
>
>> 205: @Run(test = {"testIntConstantFolding", "testIntConstantFoldingSpecialCase"})
>> 206: public void checkIntConstants(RunInfo info) {
>> 207: if (INT_CONST_2 == 0) {
>
> Since you are working on this: Could `testIntRandomLimits` not also have a division by zero exception?
Yes, it could! But this case is already covered in https://github.com/openjdk/jdk/pull/29045/files#diff-6f6b705b394c4ecdf97f05cfa5b4bd12cbac18a60a95a1ec78c943d5055a0f80R501 (the code is a bit more complex since because of the clamping we can't just check a single value)
I just forgot this case since the initial version of this test did not have random constants
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/29045#discussion_r2665875848
More information about the hotspot-compiler-dev
mailing list