-
Notifications
You must be signed in to change notification settings - Fork 102
Fix infinite loop in isSubmapOf[By]
/ isSubsetOf
on 32-bit platforms
#501
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
Conversation
...with GHC 8.2 and 8.4.
9ee657b
to
68930eb
Compare
(Stolen from the bytestring project)
68930eb
to
2b8fcae
Compare
...to ensure Unicode characters can be printed
0c74407
to
26f931d
Compare
Oh dear ... now I understand why we need a rather full audit for 32-bit systems. Or: we could go back to using a smaller branching factor on those systems. |
Yeah, that seems like a good solution to me. I think the share of users on 32bit platforms is very small these days and will continue to shrink. I wasn't too keen on hunting for issues that would affect only this particular user group. I will make a patch so |
56739e4
to
dadb590
Compare
isSubmapOfBy
(#491)isSubmapOf[By]
/ isSubsetOf
on 32-bit platforms
I think this is ready for review now. I'll clean up the commit history before merging! |
The fix looks reasonable. But are there tests you wrote that should be put back in? |
Look at For debugging, I had also added some timeouts to the property tests for |
The internal
submapBitmapIndexed
function used by these functions could enter an infinite loop while comparing two nodesm1
andm2
wherem2
contained a sub-node associated with the partial hash0b11111
. In this case the high bit of the combined bitmap ofm1
andm2
,b1Orb2
, was1
. After checking the submap condition at the high bit, the 32-bitm
variable used to iterate overb1Orb2
would be left-shifted and overflow to0
, resulting in the infinite loop.unordered-containers/Data/HashMap/Internal.hs
Lines 1551 to 1572 in 37eee22
To fix this bug and any similar issues related to a branching factor of 32, we return to a branching factor of 16 for 32-bit platforms. On 64-bit platforms the branching factors stays at 32.
Fixes #491.
TODO:
isSubmapOfBy
-fno-omit-yields
option