in reply to FPE not deferred in 5.36
Here's the case that caused me to investigate and add this change in the first place:
% $PERL-5.34.0 -MMath::GMP -wle 'local $SIG{FPE} = sub { die "fpe" }; +$z=Math::GMP->new(1); print $z / 0' Maximal count of pending signals (120) exceeded at -e line 1. fpe at -e line 1. % % $PERL-5.36.0 -MMath::GMP -wle 'local $SIG{FPE} = sub { die "fpe" }; +$z=Math::GMP->new(1); print $z / 0' fpe at -e line 1. %
The original ticket was Catching SIGFPE. Not sure why my example above isn't reproducing that, but in my real-world code this was stopping me from getting a stack trace to find where the division by zero was occurring.
Despite the name, this exception is primarily raised for integer division by zero, so the Inline::C example needs s{float}{int}g to show it. See why was sigfpe used for integer arithmetic exceptions for some more detail.
Perl itself catches these when it performs a division, so you'll only see it from non-perl code linked to your program.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: FPE not deferred in 5.36
by choroba (Cardinal) on May 31, 2022 at 15:32 UTC | |
by hv (Prior) on May 31, 2022 at 15:49 UTC | |
by choroba (Cardinal) on May 31, 2022 at 18:17 UTC |