Skip to content
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

Data/Map/Static/Builder.hs: avoid shiftL with negative offset #11

Merged
merged 1 commit into from
Aug 30, 2021
Merged

Data/Map/Static/Builder.hs: avoid shiftL with negative offset #11

merged 1 commit into from
Aug 30, 2021

Conversation

trofi
Copy link
Contributor

@trofi trofi commented Aug 29, 2020

On ghc-8.8 building encoding fails as:

Preprocessing library for encoding-0.8.5..
arithmetic overflow

This happens because findSplitSize can't handle
small values, like findSplitSize 1 and calls shiftL
with negative value, which is forbdden:
https://hackage.haskell.org/package/base-4.14.0.0/docs/Data-Bits.html#v:shiftL

Work it around by always passing non-negative offset.

On ghc-8.8 building `encoding` fails as:

```
Preprocessing library for encoding-0.8.5..
arithmetic overflow
```

This happens because `findSplitSize` can't handle
small values, like `findSplitSize 1` and calls `shiftL`
with negative value, which is forbdden:
    https://hackage.haskell.org/package/base-4.14.0.0/docs/Data-Bits.html#v:shiftL

Work it around by always passing non-negative offset.

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
@swamp-agr swamp-agr merged commit e287860 into dmwit:master Aug 30, 2021
@swamp-agr
Copy link
Collaborator

Hi @trofi, thanks for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants