[16] RFR(S): 8248552: C2 crashes with SIGFPE due to division by zero

Christian Hagedorn christian.hagedorn at oracle.com
Fri Jul 10 07:37:42 UTC 2020


Hi

Please review the following patch:
https://bugs.openjdk.java.net/browse/JDK-8248552
http://cr.openjdk.java.net/~chagedorn/8248552/webrev.00/

In the failing testcase, C2 removes a zero check for a division/modulo 
node n based on the type information of the loop induction variable phi 
p (always between 1 and 50 and never 0). However, n is later split 
through p and ends up after the AddNode which updates the induction 
variable p. In the last iteration j equals 2 and is then updated to 0. 
The division/modulo node n is now executed before the loop limit check 
which results in a SIGFPE.

The fix bails out of PhaseIdealLoop::split_thru_phi if a division or 
modulo node has its zero check removed (i.e. control in NULL) and is 
split through a phi which has an input that could be zero. This should 
only happen for an induction variable phi of a trip-counted (integer) loop.

Best regards,
Christian


More information about the hotspot-compiler-dev mailing list