summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/ExtUtils-Miniperl/lib/ExtUtils/Miniperl.pm4
-rw-r--r--miniperlmain.c2
-rw-r--r--perl.h17
3 files changed, 22 insertions, 1 deletions
diff --git a/ext/ExtUtils-Miniperl/lib/ExtUtils/Miniperl.pm b/ext/ExtUtils-Miniperl/lib/ExtUtils/Miniperl.pm
index 99276fc4c7..5cf6252918 100644
--- a/ext/ExtUtils-Miniperl/lib/ExtUtils/Miniperl.pm
+++ b/ext/ExtUtils-Miniperl/lib/ExtUtils/Miniperl.pm
@@ -8,7 +8,7 @@ use vars qw($VERSION @ISA @EXPORT);
@ISA = qw(Exporter);
@EXPORT = qw(writemain);
-$VERSION = '1.02';
+$VERSION = '1.03';
# blead will run this with miniperl, hence we can't use autodie or File::Temp
my $temp;
@@ -136,6 +136,8 @@ main(int argc, char **argv, char **env)
Perl_atfork_unlock);
#endif
+ PERL_SYS_FPU_INIT;
+
if (!PL_do_undump) {
my_perl = perl_alloc();
if (!my_perl)
diff --git a/miniperlmain.c b/miniperlmain.c
index e748523414..fa7951f73b 100644
--- a/miniperlmain.c
+++ b/miniperlmain.c
@@ -107,6 +107,8 @@ main(int argc, char **argv, char **env)
Perl_atfork_unlock);
#endif
+ PERL_SYS_FPU_INIT;
+
if (!PL_do_undump) {
my_perl = perl_alloc();
if (!my_perl)
diff --git a/perl.h b/perl.h
index 5b72bd60de..436c7d1a12 100644
--- a/perl.h
+++ b/perl.h
@@ -2898,6 +2898,23 @@ typedef SV PADNAME;
# define PERL_FPU_POST_EXEC }
#endif
+/* In Tru64 the cc -ieee enables the IEEE math but disables traps.
+ * We need to reenable the "invalid" trap because otherwise generation
+ * of NaN values leaves the IEEE fp flags in bad state, leaving any further
+ * fp ops behaving strangely (Inf + 1 resulting in zero, for example). */
+#ifdef __osf__
+# include <machine/fpu.h>
+# define PERL_SYS_FPU_INIT \
+ STMT_START { \
+ ieee_set_fp_control(IEEE_TRAP_ENABLE_INV); \
+ signal(SIGFPE, SIG_IGN); \
+ } STMT_END
+#endif
+
+#ifndef PERL_SYS_FPU_INIT
+# define PERL_SYS_FPU_INIT NOOP
+#endif
+
#ifndef PERL_SYS_INIT3_BODY
# define PERL_SYS_INIT3_BODY(argvp,argcp,envp) PERL_SYS_INIT_BODY(argvp,argcp)
#endif