-
Notifications
You must be signed in to change notification settings - Fork 9
HashSetFn
's calculation of maxSize
can cause Overflow
during functor instantiation
#279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
MLton patches the SML/NJ Library that it ships to avoid a similar problem in |
I'll resubmit this report there. However I do still believe this should be addressed in the SML/NJ repo, if for nothing but future-proofing against a possible |
Overflow during functor instantiation).
I've pushed a fix that computes floor(log2( |
This computation of floor(log2(
|
size into the internal `MaxHashTableSize` structure.
Rewrote the code to just use the |
The |
I missed it in the initial commit, but I added it about 4 hours ago. |
Uh oh!
There was an error while loading. Please reload this page.
Version
110.99.3 (Latest)
Operating System
OS Version
No response
Processor
System Component
SML/NJ Library
Severity
Major
Description
The
HashSetFn
functor (hash-set-fn.sml
) calculatesmaxSize
as the largest power of 2 that is still less thanArray.maxLen
.However, the calculation does not properly handle systems in which
Int.maxInt = SOME Array.maxLen
, causing an exception to be raised during functor instantiation.Note: This bug does not occur on the SML/NJ compiler, since
Array.maxLen
is much smaller thanInt.maxInt
.The issue is reproducible for MLton (latest version: 20230523-gd082c4a36), since there
SOME Array.maxLen = Int.maxInt
.Transcript
Expected Behavior
Instantiating the
HashSetFn
should never raiseOverflow
.Steps to Reproduce
Just run the code from the transcript.
Additional Information
This can be fixed by modifying the code at line 37 in hash-set-fn.sml:
Email address
ssoss AT uchicago DOT edu
The text was updated successfully, but these errors were encountered: