Home My Page Projects Code Snippets Project Openings SML/NJ Bugs
Summary Activity Tracker Lists

[#78] Floating point exceptions are not handled correctly on Solaris x86.

Date:
2011-09-05 16:21
Priority:
3
State:
Open
Submitted by:
Bug Submitter (webuser)
Assigned to:
John Reppy (jhr)
Machine Architecture:
x86
Operating System:
Solaris
Component:
Compiler
Resolution:
None
Severity:
Minor
OS Version:
5.10
SML/NJ Version:
110.73
Keywords:
FPE, Arithmetic Exception, Solaris, x86
URL:
Transcript (of reproduction):
% sml Standard ML of New Jersey v110.72 [built: Wed Oct 13 15:17:13 2010] - 536870909+1; val it = 536870910 : int - 536870910+1; Arithmetic Exception %
Source (for reproduction):
536870910+1;
Summary:
Floating point exceptions are not handled correctly on Solaris x86.

Detailed description
Floating point exceptions are not handled correctly (or at all) under Solaris x86.

This makes sml/nj only handle integer values up to 2^29 correctly.

The problem is present in 110.59, 110.72 and 110.73.
The problem is NOT present in 110.0.7.
I have not tested other versions.

Additional comments:
I only copied some defines for from the Solaris sparc parts and that
seem to have fixed the problem.

% sml-test
Standard ML of New Jersey v110.73 [built: Mon Sep 5 17:40:30 2011]
- 536870910+1;
val it = 536870911 : int
- 536870910*2;
val it = 1073741820 : int
- 536870910*4;

uncaught exception Overflow [overflow]
raised at: file stdIn
-


Fix:
--- ./runtime/mach-dep/signal-sysdep.h~ 2009-09-13 19:50:53.000000000 +0200
+++ ./runtime/mach-dep/signal-sysdep.h 2011-09-05 17:32:03.031470000 +0200
@@ -499,6 +499,12 @@
# elif defined(OPSYS_SOLARIS)
/** x86, Solaris */

+# define SIG_FAULT1 SIGFPE
+# define INT_DIVZERO(s, c) (((s) == SIGFPE) ((c) == FPE_INTDIV))
+# define INT_OVFLW(s, c) (((s) == SIGFPE) ((c) == FPE_INTOVF))
+
+# define SIG_GetCode(info,scp) ((info)-si_code)
+
# define SIG_GetPC(scp) ((scp)-uc_mcontext.gregs[EIP])
# define SIG_SetPC(scp, addr) { (scp)-uc_mcontext.gregs[EIP] = (int)(addr); }
# define SIG_ZeroLimitPtr(scp) { ML_X86Frame[LIMITPTR_X86OFFSET] = 0; }


Submitted via web form by Joel Fredrikson Joel.Fredrikson@it.uu.se

Comments:

No Comments Have Been Posted

Attached Files:

Changes

Field Old Value Date By
assigned_tonone2011-09-12 15:25jhr