crash_with_sigfpe() currently uses this code:
volatile int x = 0;
volatile int y = 1/x;
which does NOT cause SIGFPE on macOS (due to clang compiler optimizing it out?), so it has to fallback to using pthread_kill(SIGFPE).
However, we CAN cause SIGFPE on macOS with this code:
volatile int sigfpe_int = 0;
static void crash_with_sigfpe() {
sigfpe_int = sigfpe_int/sigfpe_int;
}
and then we don't have to fallback to pthread_kill(SIGFPE). The new code works as expected on Linux too.
Also, since the suggested code causes real crash, as opposed to it being simulated by pthread_kill(), 8237727 works just fine for "java -XX:ErrorHandlerTest=15" test case.
Otherwise, since currently it's not real SIGFPE, 8237727 causes the code to continue running without re-crashing (which we expect) and we trigger:
tty->print_cr("VMError::controlled_crash: survived intentional crash. Did you suppress the assert?");