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

[#269] Word64.fromString causes an Overflow for greater than 2^32-1

Date:
2020-08-02 17:43
Priority:
3
State:
Closed
Submitted by:
takayuki goto (eldesh)
Assigned to:
John Reppy (jhr)
Machine Architecture:
x86
Operating System:
All
Component:
Basis Library
Resolution:
Fixed
Severity:
Major
OS Version:
SML/NJ Version:
110.98
Keywords:
arithmetic overflow
URL:
Transcript (of reproduction):
$ sml -64 Standard ML of New Jersey (64-bit) v110.98 [built: Wed Jul 22 01:56:25 2020] - Word64.fromString "0xFFFFFFFF"; [autoloading] [library $SMLNJ-BASIS/basis.cm is stable] [library $SMLNJ-BASIS/(basis.cm):basis-common.cm is stable] [autoloading done] val it = SOME 0wxFFFFFFFF : Word64.word option - Word64.fromString "0x1FFFFFFFF"; uncaught exception Overflow [overflow] raised at: Basis/Implementation/num-scan64.sml:38.50-38.58
Source (for reproduction):
Summary:
Word64.fromString causes an Overflow for greater than 2^32-1

Detailed description
Word64.fromString causes an Overflow exception for strings,
which represents a value greater than 0xFFFFFFFF.

Word literals greater than 0xFFFFFFFF are accepted.
For example: `0wx1FFFFFFFF : Word64.word` is evaluated to the correct value.

Comments:

Message  ↓
Date: 2020-08-02 20:42
Sender: John Reppy

This bug was the result of constants from the 32-bit version of the code not getting updated for the 64-bit version. Scanning of both hexadecimal and octal representations of both integers and words were affected.

Attached Files:

Changes

Field Old Value Date By
status_idOpen2020-08-02 20:42jhr
close_dateNone2020-08-02 20:42jhr
assigned_tonone2020-08-02 20:42jhr
summaryWord64.fromString causes an Overflow exn for greater than 32bit repr2020-08-02 20:42jhr
Operating SystemNone2020-08-02 20:42jhr
ResolutionNone2020-08-02 20:42jhr
SeverityCritical2020-08-02 20:42jhr
Transcript (of reproduction) $ sml -64 Standard ML of New Jersey (64-bit) v110.98 [built: Wed Jul 22 01:56:25 2020] - Word64.fromString "0xFFFFFFFF"; [autoloading] [library $SMLNJ-BASIS/basis.cm is stable] [library $SMLNJ-BASIS/(basis.cm):basis-common.cm is stable] [autoloading done] val it = SOME 0wxFFFFFFFF : Word64.word option - Word64.fromString "0x1FFFFFFFF"; uncaught exception Overflow [overflow] raised at: Basis/Implementation/num-scan64.sml:38.50-38.58 2020-08-02 20:42jhr