While reading its delta (to decide what changes need to be done to Syntax::Construct), I noticed the following paragraph:
SIGFPE no longer deferred
Floating-point exceptions are now delivered immediately, in the same way as other "fault"-like signals such as SIGSEGV. This means one has at least a chance to catch such a signal with a $SIG{FPE} handler, e.g. so that die can report the line in perl that triggered it.
I tried to come up with code that triggers the Floating Point E{xception/rror} but I couldn't find any.
local $SIG{FPE} = sub { die "SIGNAL @_" }; my $x = 0; print 2 / $x;
I tried with sqrt -1, no difference. I asked on IRC and was given an example with Inline::C, but even that doesn't behave differently in the new Perl version:
#!/usr/bin/perl use warnings; use strict; use Inline 'C' => <<'__C__'; float killme() { volatile float f = 0.0; volatile float c = f / f; return c; } __C__ local $SIG{FPE} = sub { die "SIGNAL @_" }; print killme();
Can anyone provide an example that shows how the FPE signal is emitted and how its trapping is different in 5.36?
In reply to FPE not deferred in 5.36 by choroba
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |