Negative literal equal to minBound gives a spurious warning
In GHCi:
λ > import GHC.Int
λ > -128 :: Int8
<interactive>:25:2: warning: [-Woverflowed-literals]
Literal 128 is out of the Int8 range -128..127
If you are trying to write a large negative literal, use NegativeLiterals
-128
λ > minBound :: Int8
-128
Since -128 :: Int8
is equal to minBound :: Int8
this warning is not correct.
Similar issues exist for Int16
, Int32
etc.
Suspect this is related to the fix for #8542 (closed).
Trac metadata
Trac field | Value |
---|---|
Version | 8.0.1 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |