[GHC] #14536: Ghc panics while building stage2 with -dstg-lint

#14536: Ghc panics while building stage2 with -dstg-lint -------------------------------------+------------------------------------- Reporter: duog | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.3 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- Building ghc at 54fda257d4a7bfddaa0c1fa0be698d1a849c4124 with the following mk/build.mk: {{{ BuildFlavour = validate ifneq "$(BuildFlavour)" "" include mk/flavours/$(BuildFlavour).mk endif GhcStage2HcOpts += -dcore-lint -dstg-lint -dcmm-lint }}} building with: {{{ make compiler/stage2/build/Exception.o }}} panics with: {{{ ghc-stage1: panic! (the 'impossible' happened) (GHC version 8.3.20171127 for x86_64-unknown-linux): ASSERT failed! dataConInstArgTys Unit# [k0_10, a_11] ['TupleRep '[], 'IntRep, State# RealWorld, Int#] Call stack: CallStack (from HasCallStack): callStackDoc, called at compiler/utils/Outputable.hs:1208:22 in ghc:Outputable assertPprPanic, called at compiler/basicTypes/DataCon.hs:1256:76 in ghc:DataCon Call stack: CallStack (from HasCallStack): callStackDoc, called at compiler/utils/Outputable.hs:1150:37 in ghc:Outputable pprPanic, called at compiler/utils/Outputable.hs:1206:5 in ghc:Outputable assertPprPanic, called at compiler/basicTypes/DataCon.hs:1256:76 in ghc:DataCon Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug }}} Once this is resolved, is there any reason that -dstg-ling and -dcmm-lint are not set on validate (at least with SLOW)? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14536 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14536: Ghc panics while building stage2 with -dstg-lint -------------------------------------+------------------------------------- Reporter: duog | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonpj): Humph. The 'unarise' pass, which is performed on STG, also transforms types. In this case we transform {{{ case getMaskingState# eta of x { (# a, b #) -> blah ===> case getMaskingState# eta of x { Unit# a -> blah -- Unit# is really a one-tuple (# a #) }}} Here we eliminate the void field (the state token). But that changes the type of the scrutinee; but we don't in fact change the type of the case-binder `x`; and that in turn leads to the crash. It's not very convenient to get hold of `x`'s new type; and in any case `x` is guaranteed to be dead. So it seems hardly worth writing more code. Lets either * Simply drop the lint check (in `litAlt`, don't call `dataConInstArgTys`); or * Make the case-binder into a `Maybe` and only check its type when it's a `Just`. I suspect that the former is simpler for now; do leave a comment to link to this ticket though. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14536#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14536: Ghc panics while building stage2 with -dstg-lint -------------------------------------+------------------------------------- Reporter: duog | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.3 Resolution: | Keywords: stg-lint Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * keywords: => stg-lint -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14536#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14536: Ghc panics while building stage2 with -dstg-lint -------------------------------------+------------------------------------- Reporter: duog | Owner: duog Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.3 Resolution: | Keywords: stg-lint Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by duog): * owner: (none) => duog Comment: Thanks, I'll see if I can fix it. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14536#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14536: Ghc panics while building stage2 with -dstg-lint -------------------------------------+------------------------------------- Reporter: duog | Owner: duog Type: bug | Status: patch Priority: normal | Milestone: Component: Compiler | Version: 8.3 Resolution: | Keywords: stg-lint Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D4242 Wiki Page: | -------------------------------------+------------------------------------- Changes (by duog): * status: new => patch * differential: => Phab:D4242 Comment: Fixed this one, found another: ticket:14541 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14536#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14536: Ghc panics while building stage2 with -dstg-lint -------------------------------------+------------------------------------- Reporter: duog | Owner: duog Type: bug | Status: patch Priority: high | Milestone: 8.6.1 Component: Compiler | Version: 8.3 Resolution: | Keywords: stg-lint Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D4242 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * priority: normal => high * milestone: => 8.6.1 Comment: Any news on this, duog? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14536#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14536: Ghc panics while building stage2 with -dstg-lint -------------------------------------+------------------------------------- Reporter: duog | Owner: duog Type: bug | Status: patch Priority: high | Milestone: 8.6.1 Component: Compiler | Version: 8.3 Resolution: | Keywords: stg-lint Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D4242 Wiki Page: | -------------------------------------+------------------------------------- Comment (by duog): I have a half finished patch to fix all the unarisation issues. There are quite a few. I'll try and get it onto phab this week or next. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14536#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14536: Ghc panics while building stage2 with -dstg-lint -------------------------------------+------------------------------------- Reporter: duog | Owner: duog Type: bug | Status: patch Priority: high | Milestone: 8.6.1 Component: Compiler | Version: 8.3 Resolution: | Keywords: stg-lint Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D4242 Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonpj):
I have a half finished patch to fix all the unarisation issues. There are quite a few.
Thanks! Can you enumerate what the "unarisation issues" are, precisely? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14536#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14536: Ghc panics while building stage2 with -dstg-lint -------------------------------------+------------------------------------- Reporter: duog | Owner: duog Type: bug | Status: patch Priority: high | Milestone: 8.6.1 Component: Compiler | Version: 8.3 Resolution: | Keywords: stg-lint Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D4242 Wiki Page: | -------------------------------------+------------------------------------- Comment (by duog): Replying to [comment:7 simonpj]:
Thanks! Can you enumerate what the "unarisation issues" are, precisely?
This is mostly from memory, so may not be as precise as I would like, however: * StgLint does not currently account for the fact that the types and number of arguments to `StgRhsCon`, `StgConApp` and `StgApp` change after unarisation. * StgLint does try to account for the unarisation changes in case scrutinees and Alts, but it's not quite right. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14536#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14536: Ghc panics while building stage2 with -dstg-lint -------------------------------------+------------------------------------- Reporter: duog | Owner: duog Type: bug | Status: closed Priority: high | Milestone: 8.6.1 Component: Compiler | Version: 8.3 Resolution: fixed | Keywords: stg-lint Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D4242 Wiki Page: | -------------------------------------+------------------------------------- Changes (by osa1): * status: patch => closed * resolution: => fixed Comment: Fixed via #14787. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14536#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14536: Ghc panics while building stage2 with -dstg-lint -------------------------------------+------------------------------------- Reporter: duog | Owner: duog Type: bug | Status: closed Priority: high | Milestone: 8.6.1 Component: Compiler | Version: 8.3 Resolution: fixed | Keywords: stg-lint Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #14787 | Differential Rev(s): Phab:D4242 Wiki Page: | -------------------------------------+------------------------------------- Changes (by osa1): * related: => #14787 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14536#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC