[GHC] #11290: T6031: *** Core Lint errors : in result of Common sub-expression ***

#11290: T6031: *** Core Lint errors : in result of Common sub-expression *** -------------------------------------+------------------------------------- Reporter: thomie | Owner: Type: bug | Status: new Priority: highest | Milestone: 8.0.1 Component: Compiler | Version: 7.11 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: deriving/should_compile/T6031 | Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- {{{ $ make test TEST=T6031 WAY=optasm TEST_HC=ghc-7.11.20151225 ... =====> T6031(optasm) 1 of 1 [0, 0, 0] cd ./deriving/should_compile && "/opt/ghc/head/bin/ghc-head" --make T6031 -fforce-recomp -dcore-lint -dcmm-lint -dno-debug-output -no-user- package-db -rtsopts -fno-warn-tabs -fno-warn-missed-specialisations -fno- ghci-history -O -fasm -v0 > T6031.comp.stderr 2>&1 Compile failed (status 256) errors were: *** Core Lint errors : in result of Common sub-expression *** <no location info>: warning: [in body of lambda with binder x_aSX :: Empty] No alternatives for a case scrutinee not known to diverge for sure: lvl_sUb *** Offending Program *** lvl_sTZ :: [Char] [LclId, Str=DmdType] lvl_sTZ = unpackCString# "error"# lvl_sU0 :: [Char] [LclId, Str=DmdType] lvl_sU0 = unpackCString# "main"# lvl_sU1 :: [Char] [LclId, Str=DmdType] lvl_sU1 = unpackCString# "T6031"# lvl_sU2 :: [Char] [LclId, Str=DmdType] lvl_sU2 = unpackCString# "T6031.hs"# lvl_sU3 :: Int [LclId, Str=DmdType] lvl_sU3 = I# 7# lvl_sU4 :: Int [LclId, Str=DmdType] lvl_sU4 = I# 1# lvl_sU5 :: Int [LclId, Str=DmdType] lvl_sU5 = lvl_sU3 lvl_sU6 :: Int [LclId, Str=DmdType] lvl_sU6 = I# 29# lvl_sU7 :: SrcLoc [LclId, Str=DmdType] lvl_sU7 = SrcLoc lvl_sU0 lvl_sU1 lvl_sU2 lvl_sU3 lvl_sU4 lvl_sU3 lvl_sU6 lvl_sU8 :: ([Char], SrcLoc) [LclId, Str=DmdType] lvl_sU8 = (lvl_sTZ, lvl_sU7) lvl_sU9 :: CallStack [LclId, Str=DmdType] lvl_sU9 = PushCallStack lvl_sU8 EmptyCallStack lvl_sUa :: [Char] [LclId, Str=DmdType] lvl_sUa = unpackCString# "Void showsPrec"# $cshowsPrec_aQD :: Int -> Empty -> ShowS [LclId, Str=DmdType b] $cshowsPrec_aQD = error @ 'Lifted @ (Int -> Empty -> ShowS) (lvl_sU9 `cast` (Sym (NTCo:IP[0] <"callStack">_N <CallStack>_N) :: CallStack ~R# (?callStack::CallStack))) lvl_sUa lvl_sUb :: Empty -> ShowS [LclId, Str=DmdType] lvl_sUb = case $cshowsPrec_aQD of wild_00 { } $cshowList_aQR :: [Empty] -> ShowS [LclId, Arity=2, Str=DmdType] $cshowList_aQR = showList__ @ Empty lvl_sUb $cshow_aQN :: Empty -> String [LclId, Arity=1, Str=DmdType b, Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=ALWAYS_IF(arity=1,unsat_ok=True,boring_ok=False) Tmpl= \ _ [Occ=Dead] -> case $cshowsPrec_aQD of _ [Occ=Dead] { }}] $cshow_aQN = \ _ [Occ=Dead] -> case $cshowsPrec_aQD of wild_00 { } $fShowEmpty [InlPrag=[ALWAYS] CONLIKE] :: Show Empty [LclIdX[DFunId], Str=DmdType m, Unf=DFun: \ -> D:Show TYPE: Empty $cshowsPrec_aQD $cshow_aQN $cshowList_aQR] $fShowEmpty = D:Show @ Empty $cshowsPrec_aQD $cshow_aQN $cshowList_aQR $sshows_sTu :: Empty -> String -> String [LclId, Str=DmdType b, Unf=Unf{Src=InlineStable, TopLvl=True, Value=False, ConLike=False, WorkFree=True, Expandable=True, Guidance=ALWAYS_IF(arity=0,unsat_ok=True,boring_ok=False) Tmpl= case $cshowsPrec_aQD of _ [Occ=Dead] { }}] $sshows_sTu = lvl_sUb $s$dmshow_sTv :: Empty -> String [LclId, Arity=1, Str=DmdType b, Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=ALWAYS_IF(arity=-1,unsat_ok=True,boring_ok=False) Tmpl= \ _ [Occ=Dead] -> case lvl_sUb of _ [Occ=Dead] { }}] $s$dmshow_sTv = $cshow_aQN a_sT8 :: TrName [LclId, Str=DmdType m1] a_sT8 = TrNameS "main"# a_sT9 :: TrName [LclId, Str=DmdType m1] a_sT9 = TrNameS "T6031"# $trModule :: Module [LclIdX[ReflectionId], Str=DmdType m] $trModule = Module a_sT8 a_sT9 *** End of Offense *** <no location info>: error: Compilation had errors *** unexpected failure for T6031(optasm) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11290 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11290: T6031: *** Core Lint errors : in result of Common sub-expression *** -------------------------------------+------------------------------------- Reporter: thomie | Owner: Type: bug | Status: new Priority: highest | Milestone: 8.0.1 Component: Compiler | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | deriving/should_compile/T6031, | deriving/should_run/T7931 (WAY=hpc) Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by thomie): * testcase: deriving/should_compile/T6031 => deriving/should_compile/T6031, deriving/should_run/T7931 (WAY=hpc) Comment: T7931 fails as well, with `WAY=hpc`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11290#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11290: T6031: *** Core Lint errors : in result of Common sub-expression *** -------------------------------------+------------------------------------- Reporter: thomie | Owner: Type: bug | Status: new Priority: highest | Milestone: 8.0.1 Component: Compiler | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | deriving/should_compile/T6031, | deriving/should_run/T7931 (WAY=hpc) Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by osa1): * cc: osa1 (added) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11290#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11290: T6031: *** Core Lint errors : in result of Common sub-expression *** -------------------------------------+------------------------------------- Reporter: thomie | Owner: Type: bug | Status: new Priority: highest | Milestone: 8.0.1 Component: Compiler | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | deriving/should_compile/T6031, | deriving/should_run/T7931 (WAY=hpc) Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by nomeata): FTR: This is just a lint warning, and not an error, and as such not always correct. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11290#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11290: T6031: *** Core Lint errors : in result of Common sub-expression *** -------------------------------------+------------------------------------- Reporter: thomie | Owner: Type: bug | Status: new Priority: highest | Milestone: 8.0.1 Component: Compiler | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | deriving/should_compile/T6031, | deriving/should_run/T7931 (WAY=hpc) Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by goldfire): I think it says `warning`, but if it stops compilation, then it's a real error. And it should be: `case` expressions must have all possible alternative listed, or we have a potential type error. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11290#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11290: T6031: *** Core Lint errors : in result of Common sub-expression *** -------------------------------------+------------------------------------- Reporter: thomie | Owner: Type: bug | Status: new Priority: highest | Milestone: 8.0.1 Component: Compiler | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | deriving/should_compile/T6031, | deriving/should_run/T7931 (WAY=hpc) Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by nomeata): In this case, the lint error is a false alarm: {{{ lvl_sUb :: Empty -> ShowS [LclId, Str=DmdType] lvl_sUb = case $cshowsPrec_aQD of wild_00 { } $cshowList_aQR :: [Empty] -> ShowS }}} is indeed diverging for sure. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11290#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11290: T6031: *** Core Lint errors : in result of Common sub-expression *** -------------------------------------+------------------------------------- Reporter: thomie | Owner: Type: bug | Status: new Priority: highest | Milestone: 8.0.1 Component: Compiler | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | deriving/should_compile/T6031, | deriving/should_run/T7931 (WAY=hpc) Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by nomeata):
I think it says warning, but if it stops compilation, then it's a real error.
And it should be: case expressions must have all possible alternative
Right, the intention for the warning is to complain, but keep going, so this needs fixing. (I wouldn’t miss this warning if it were gone completely, as it cannot be complete) listed, or we have a potential type error. Not if the scrutinee diverges, as it is the case here. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11290#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11290: T6031: *** Core Lint errors : in result of Common sub-expression *** -------------------------------------+------------------------------------- Reporter: thomie | Owner: Type: bug | Status: new Priority: highest | Milestone: 8.0.1 Component: Compiler | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | deriving/should_compile/T6031, | deriving/should_run/T7931 (WAY=hpc) Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by osa1): I don't think the scrutinee is diverging here, I think the problem is something else. I tried to debug this a little bit, here's some more info about the error: {{{ <no location info>: warning: [in body of lambda with binder x_aT4 :: Empty] No alternatives for a case scrutinee not known to diverge for sure: lvl_sUi The whole expression: case lvl_sUi of _ [Occ=Dead] { } Scrutinee type: Empty -> ShowS Expression type: String }}} Here from the type of the scrutinee we can't say it's diverging, because that type has inhabitants like {{{const ""}}} etc. One weird thing about this error message is that in the printed module {{{x_aT4}}} is not used at all, so I'm not sure where did the linter find that variable. Too bad we don't have stack traces.. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11290#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11290: T6031: *** Core Lint errors : in result of Common sub-expression *** -------------------------------------+------------------------------------- Reporter: thomie | Owner: Type: bug | Status: new Priority: highest | Milestone: 8.0.1 Component: Compiler | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | deriving/should_compile/T6031, | deriving/should_run/T7931 (WAY=hpc) Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by nomeata):
I don't think the scrutinee is diverging here
Sure it is! The error says the scrutinee is `lvl_sUi`. We have `lvl_sUb = case $cshowsPrec_aQD of wild_00 { }` and {{{ $cshowsPrec_aQD :: Int -> Empty -> ShowS [LclId, Str=DmdType b] $cshowsPrec_aQD = error @ 'Lifted @ (Int -> Empty -> ShowS) (lvl_sU9 `cast` (Sym (NTCo:IP[0] <"callStack">_N <CallStack>_N) :: CallStack ~R# (?callStack::CallStack))) lvl_sUa }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11290#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11290: T6031: *** Core Lint errors : in result of Common sub-expression *** -------------------------------------+------------------------------------- Reporter: thomie | Owner: Type: bug | Status: new Priority: highest | Milestone: 8.0.1 Component: Compiler | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | deriving/should_compile/T6031, | deriving/should_run/T7931 (WAY=hpc) Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonpj): Ah. The trouble is that the previous float-out pass transforms {{{ f = ...(case $cshowsPrec_aQi of { })... x{str=bot} = case $cshowsPrec_aQi of { } }}} into {{{ lvl = case $cshowsPrec_aQi of { } f = ...(case $cshowsPrec_aQi of { })... x{str=bot} = case $cshowsPrec_aQi of { } }}} But 'lvl' doesn't have a strictness annotation. Now CSE gets rid of `x` in favour of `lvl`. And then Lint complains when it finds a previously legitimate `(case x of {})`. I have a fix coming, that will deal with this case nicely. It just involves broadening the cases handled by `Note [Bottoming floats]` in `SetLevels`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11290#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11290: T6031: *** Core Lint errors : in result of Common sub-expression ***
-------------------------------------+-------------------------------------
Reporter: thomie | Owner:
Type: bug | Status: new
Priority: highest | Milestone: 8.0.1
Component: Compiler | Version: 7.11
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
| deriving/should_compile/T6031,
| deriving/should_run/T7931 (WAY=hpc)
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Simon Peyton Jones

#11290: T6031: *** Core Lint errors : in result of Common sub-expression *** -------------------------------------+------------------------------------- Reporter: thomie | Owner: Type: bug | Status: closed Priority: highest | Milestone: 8.0.1 Component: Compiler | Version: 7.11 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | deriving/should_compile/T6031, | deriving/should_run/T7931 (WAY=hpc) Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by simonpj): * status: new => closed * resolution: => fixed -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11290#comment:11 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11290: T6031: *** Core Lint errors : in result of Common sub-expression *** -------------------------------------+------------------------------------- Reporter: thomie | Owner: Type: bug | Status: merge Priority: highest | Milestone: 8.0.1 Component: Compiler | Version: 7.11 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | deriving/should_compile/T6031, | deriving/should_run/T7931 (WAY=hpc) Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: closed => merge -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11290#comment:12 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11290: T6031: *** Core Lint errors : in result of Common sub-expression *** -------------------------------------+------------------------------------- Reporter: thomie | Owner: Type: bug | Status: closed Priority: highest | Milestone: 8.0.1 Component: Compiler | Version: 7.11 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | deriving/should_compile/T6031, | deriving/should_run/T7931 (WAY=hpc) Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: merge => closed -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11290#comment:13 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC