[jdk16] RFR: 8259227: C2 crashes with SIGFPE due to a division that floats above its zero check

Tobias Hartmann thartmann at openjdk.java.net
Thu Jan 7 11:01:02 UTC 2021


On Wed, 6 Jan 2021 13:43:17 GMT, Christian Hagedorn <chagedorn at openjdk.org> wrote:

> This bug is very similar to [JDK-8257822](https://bugs.openjdk.java.net/browse/JDK-8257822). In this testcase, a `Div` node has no longer its zero check as direct control input and is later moved before the zero check by `IfNode::dominated_by()` which updates all data nodes to a dominating `If` (in JDK-8257822 it was done by `PhaseIdealLoop::dominated_by()`) .
> 
> I suggest to use the same fix for `IfNode::dominated_by()` as for `PhaseIdealLoop::dominated_by()` in JDK-8257822 to only move data nodes to the dominating `If` if it is not a `Div` or `Mod` node that could have a zero divisor (i.e. a zero check).
> 
> Thanks,
> Christian

Otherwise looks good to me.

test/hotspot/jtreg/compiler/loopopts/TestDivZeroDominatedBy.java line 31:

> 29:  * @requires vm.compiler2.enabled
> 30:  * @run main/othervm -Xcomp -XX:-TieredCompilation -XX:CompileOnly=compiler/loopopts/TestDivZeroDominatedBy::test
> 31:  *                   -XX:+UnlockDiagnosticVMOptions -XX:+StressGCM -XX:StressSeed=917280111 compiler.loopopts.TestDivZeroDominatedBy

Just wondering if the `StressSeed` should really be hardcoded? If things change in the VM, this seed might not longer reproduce the issue. Maybe add another `@run `with no fixed seed?

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

Marked as reviewed by thartmann (Reviewer).

PR: https://git.openjdk.java.net/jdk16/pull/89


More information about the hotspot-compiler-dev mailing list