Skip to content

Literal overflow check is too aggressive

The literal overflow check is too aggressive. Sometimes you want to give a literal as a hexadecimal value that does fit inside e.g. an Int, like so:

Prelude> 0xdc36d1615b7400a4 :: Int

<interactive>:2:1: Warning:
    Literal 15868100553162883236 is out of the Int range -9223372036854775808..9223372036854775807
-2578643520546668380

However the compiler complains because of the wrap-around. I feel this is common enough and practice (and perfectly well-defined) that the compiler shouldn't warn.

Trac metadata
Trac field Value
Version 7.8.3
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information