GHC 7.10.1 segfaults when shiftL-ing Integers by negative amounts
For numbers other than 1, anyway.
$ ghc -e 'Data.Bits.shiftL 1 (-1)'
-9223372036854775808
$ ghc -e 'Data.Bits.shiftL 2 (-1)'
zsh: segmentation fault ghc -e 'Data.Bits.shiftL 2 (-1)'
$ ghc -e 'Data.Bits.shiftL 100 (-1)'
zsh: segmentation fault ghc -e 'Data.Bits.shiftL 100 (-1)'
This also happens with a compiled program. It doesn't with shiftR in either case though.
Side notes:
- On OS X, when the first operand is also negative, I get a
bus errorinstead of asegmentation fault. Linux givessegmentation faulton both. - On Linux, you have to use
ghciinstead of-e, for some (probably unrelated?) reason).
Trac metadata
| Trac field | Value |
|---|---|
| Version | 7.10.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |