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

[#229] Real.fromString errors

Date:
2019-11-02 04:19
Priority:
3
State:
Closed
Submitted by:
Bug Submitter (webuser)
Assigned to:
John Reppy (jhr)
Machine Architecture:
x86
Operating System:
Linux
Component:
Basis Library
Resolution:
Fixed
Severity:
Major
OS Version:
SML/NJ Version:
110.94 (32-bit)
Keywords:
reals
URL:
Transcript (of reproduction):
[mtf@sulfur smlnj]$ for v in 110.93 110.94-32 110.94-64; do echo 'Real.fromString "0.00000000000e123213213123213123123"' | ./smlnj-$v/bin/sml; done Standard ML of New Jersey v110.93 [built: Fri Nov 01 09:18:58 2019] - = [autoloading] [library $SMLNJ-BASIS/basis.cm is stable] [library $SMLNJ-BASIS/(basis.cm):basis-common.cm is stable] [autoloading done] val it = SOME inf : real option Standard ML of New Jersey (32-bit) v110.94 [built: Fri Nov 01 23:02:58 2019] - = [autoloading] [library $SMLNJ-BASIS/basis.cm is stable] [library $SMLNJ-BASIS/(basis.cm):basis-common.cm is stable] [autoloading done] Segmentation fault (core dumped) Standard ML of New Jersey (64-bit) v110.94 [built: Fri Nov 01 23:55:39 2019] - = [autoloading] [library $SMLNJ-BASIS/basis.cm is stable] [library $SMLNJ-BASIS/(basis.cm):basis-common.cm is stable] [autoloading done] val it = SOME inf : real option
Source (for reproduction):
Real.fromString "0.00000000000e123213213123213123123"
Summary:
Real.fromString errors

Detailed description
I observe a segementation fault with `Real.fromString` on a valid
(but unusual) input with 110.94 (32-bit).

Neither 110.93 nor 110.94 (64-bit) exhibits the segmentation
fault, but both return the wrong answer.
Additional comments:
The wrong answer bug presumably was introduced as part of the fix
for bug #194 (https://smlnj-gforge.cs.uchicago.edu/scm/viewvc.php?view=rev&root=smlnj&revision=4520);
a large positive exponent, but zero mantissa, should return 0,
rather than posInf.


Submitted via web form by Matthew Fluet <Matthew.Fluet@gmail.com>

Comments:

Message  ↓
Date: 2019-11-07 19:23
Sender: John Reppy

The fix is two parts. The result of Real.posInf, instead of 0.0 has been fixed in the RealScan module in the basis implementation. The crash on x86/linux was the result of assuming that SIGFPE was the signal that is raised by the `into` instruction, when, in fact, the signal is SIGSEGV.

Both of these fixes are in place for 110.95.

Date: 2019-11-03 14:31
Sender: John Reppy

The memory fault seems to be specific to Linux; it just returns infinity on macOS.

Attached Files:

Changes

Field Old Value Date By
status_idOpen2019-11-07 19:23jhr
close_dateNone2019-11-07 19:23jhr
ResolutionAccepted As Bug2019-11-07 19:23jhr
assigned_tonone2019-11-03 14:31jhr
detailsI observe a segementation fault with `Real.fromString` on a valid (but unusual) input with 110.94 (32-bit). Neither 110.93 nor 110.94 (64-bit) exhibits the segmentation fault, but both return the wrong answer. Additional comments: The wrong answer bug presumably was introduced as part of the fix for bug #194 (https://smlnj-gforge.cs.uchicago.edu/scm/viewvc.php?view=rev&root=smlnj&revision=4520); a large positive exponent, but zero mantissa, should return 0, rather than posInf. Submitted via web form by Matthew Fluet <Matthew.Fluet@gmail.com> 2019-11-03 14:31jhr
ResolutionNone2019-11-03 14:31jhr
Transcript (of reproduction)[mtf@sulfur smlnj]$ for v in 110.93 110.94-32 110.94-64; do echo 'Real.fromString "0.00000000000e123213213123213123123"' | ./smlnj-$v/bin/sml; done Standard ML of New Jersey v110.93 [built: Fri Nov 01 09:18:58 2019] - = [autoloading] [library $SMLNJ-BASIS/basis.cm is stable] [library $SMLNJ-BASIS/(basis.cm):basis-common.cm is stable] [autoloading done] val it = SOME inf : real option Standard ML of New Jersey (32-bit) v110.94 [built: Fri Nov 01 23:02:58 2019] - = [autoloading] [library $SMLNJ-BASIS/basis.cm is stable] [library $SMLNJ-BASIS/(basis.cm):basis-common.cm is stable] [autoloading done] Segmentation fault (core dumped) Standard ML of New Jersey (64-bit) v110.94 [built: Fri Nov 01 23:55:39 2019] - = [autoloading] [library $SMLNJ-BASIS/basis.cm is stable] [library $SMLNJ-BASIS/(basis.cm):basis-common.cm is stable] [autoloading done] val it = SOME inf : real option 2019-11-03 14:31jhr