panic in new integer switch logic with "out-of-range" literals
Compiling this module
module D (f) where
f :: Int -> String
f n = case n of
0x8000000000000000 -> "yes"
_ -> "no"
crashes with the error
[1 of 1] Compiling D ( /tmp/D.hs, /tmp/D.o )
ghc-stage1: panic! (the 'impossible' happened)
(GHC version 7.11.20150403 for x86_64-unknown-linux):
Map.findMin: empty map has no minimal element
The constant does not have to be exactly 0x8000000000000000
, everything I tested from there up to 0xffffffffffffffff
yields the same crash. Also occurs with Word
and negative literals.
The bug seems to be tied to the target's word size somehow, though: a 64-bit compiler does not panic on Int32
and 0x80000000
, but a 32-bit compiler does.
Trac metadata
Trac field | Value |
---|---|
Version | 7.11 |
Type | Bug |
TypeOfFailure | CompileTimeCrash |
Priority | high |
Resolution | Unresolved |
Component | Compiler (CodeGen) |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | nomeata, simonmar |
Operating system | |
Architecture |