As a naive workaround, the following simple patch would prevent division by zero and SIGFPE:
int round_div(int num, int den) { - return (num + (den / 2)) / den; + return den ? (num + (den / 2)) / den : 0; }
Reported values now would be zeros, which is certainly wrong, but at least the program no longer crashes:
... XTAL: 27.0 MHz, RefDiv: 0
Core: 0.0 MHz, Mem: 0.0 MHz
As a naive workaround, the following simple patch would prevent division by zero and SIGFPE:
int round_div(int num, int den)
{
- return (num + (den / 2)) / den;
+ return den ? (num + (den / 2)) / den : 0;
}
Reported values now would be zeros, which is certainly wrong, but at least the program no longer crashes:
...
XTAL: 27.0 MHz, RefDiv: 0
Core: 0.0 MHz, Mem: 0.0 MHz