[GHC] #13107: Negative literal equal to minBound gives a spurious warning

GHC ghc-devs at haskell.org
Wed Jan 11 08:31:53 UTC 2017


#13107: Negative literal equal to minBound gives a spurious warning
-------------------------------------+-------------------------------------
           Reporter:  erikd          |             Owner:
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.0.1
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  Incorrect
  Unknown/Multiple                   |  error/warning at compile-time
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 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.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13107>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list