
#8542: Suggest NegativeLiterals -------------------------------------+------------------------------------- Reporter: monoidal | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.7 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | numeric/should_fail/T8542 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by alpmestan): The `hpc` way fails on `T8542`: {{{ =====> T8542(hpc) 1 of 1 [0, 0, 0] cd "./numeric/should_compile/T8542.run" && "/home/alp/ghc/inplace/test spaces/ghc-stage2" -c T8542.hs -dcore-lint -dcmm-lint -no-user-package-db -rtsopts -fno-warn-missed-specialisations -fshow-warning-groups -fdiagnostics-color=never -fno-diagnostics-show-caret -dno-debug-output -O -fhpc Actual stderr output differs from expected: diff -uw "./numeric/should_compile/T8542.run/T8542.stderr.normalised" "./numeric/should_compile/T8542.run/T8542.comp.stderr.normalised" --- ./numeric/should_compile/T8542.run/T8542.stderr.normalised 2018-03-08 10:24:05.303965000 +0100 +++ ./numeric/should_compile/T8542.run/T8542.comp.stderr.normalised 2018-03-08 10:24:05.303965000 +0100 @@ -1,4 +1,8 @@ +T8542.hs:6:6: warning: [-Woverflowed-literals (in -Wdefault)] + Literal 128 is out of the Int8 range -128..127 + If you are trying to write a large negative literal, use NegativeLiterals + T8542.hs:9:5: warning: [-Woverflowed-literals (in -Wdefault)] Literal 128 is out of the Int8 range -128..127 If you are trying to write a large negative literal, use NegativeLiterals *** unexpected failure for T8542(hpc) }}} Somehow, unlike all the other ways, it ends up warning us about both occurences of `128` in: {{{#!hs module T8542 where import GHC.Int x :: Int8 x = -128 y :: Int8 y = 128 }}} instead of realizing that the first literal is `-128` directly, which _is_ within the `[-128 .. 127]` range but supposedly not considered because `NegativeLiterals` is not on? It does sound like a little bug, and I'm curious as to why we don't see it with any of the other ways, even though to be honest I'm not familiar with the `hpc` way. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8542#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler