[GHC] #14650: Panic with no extensions (StgCmmEnv: variable not found)
#14650: Panic with no extensions (StgCmmEnv: variable not found) -------------------------------------+------------------------------------- Reporter: Zemyla | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.2 Keywords: | Operating System: Unknown/Multiple Architecture: x86_64 | Type of failure: Compile-time (amd64) | crash or panic Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- When I compile the attached Haskell program with `-O2`, or `-O1` with `-fspec-constr` added, I get a compiler panic: {{{ ghc: panic! (the 'impossible' happened) (GHC version 8.2.2 for x86_64-unknown-mingw32): StgCmmEnv: variable not found $smergeSplit_s3bq local binds for: $WLL $W:% $W:& cmp_s3ox eta_s3oy $wmergeLL_s3oz $s$wpush_s3pZ $wpush_s3q0 $s$wmergeAll_s3rl $wmergeAll_s3rR $wsplitDesc_s3sp $wsplitAsc_s3sC mergeSplit_s3tt ss_s3tu ds_s3tv wild_s3tw a1_s3tC as'_s3tD wild1_s3tE b_s3tF bs_s3tG wild2_s3tH ww1_s3tJ ww2_s3tK ww3_s3tL ww4_s3tM ww6_s3tO ww7_s3tP ww8_s3tQ ww9_s3tR Call stack: CallStack (from HasCallStack): prettyCurrentCallStack, called at compiler\utils\Outputable.hs:1133:58 in ghc:Outputable callStackDoc, called at compiler\utils\Outputable.hs:1137:37 in ghc:Outputable pprPanic, called at compiler\codeGen\StgCmmEnv.hs:147:9 in ghc:StgCmmEnv }}} I ran it with `-dcore-lint`, and it gives the following messages (full .lint attached): {{{ *** Core Lint errors : in result of Simplifier *** <no location info>: warning: In the expression: jump $smergeSplit_s3bN ww_s34F ww_s34Q ww_s34R ww_s34S ww_s34T $smergeSplit_s3bN [Occ=LoopBreaker] :: [a_a23n] -> Int# -> Bool -> [a_a23n] -> Stack a_a23n -> [a_a23n] [LclId[JoinId(5)], Arity=5, Str=<S,U><L,U><L,U><L,U><L,U>, Unf=Unf{Src=<vanilla>, TopLvl=False, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [80 0 0 0 0] 554 0}] is out of scope <no location info>: warning: In the expression: jump $smergeSplit_s3bN ww_s34F ww_s34Q ww_s34R ww_s34S ww_s34T Invalid occurrence of a join variable: $smergeSplit_s3bN The binder is either not a join point, or not valid here <no location info>: warning: In the expression: jump $smergeSplit_s3bN ww_s34K ww_s34Q ww_s34R ww_s34S ww_s34T $smergeSplit_s3bN [Occ=LoopBreaker] :: [a_a23n] -> Int# -> Bool -> [a_a23n] -> Stack a_a23n -> [a_a23n] [LclId[JoinId(5)], Arity=5, Str=<S,U><L,U><L,U><L,U><L,U>, Unf=Unf{Src=<vanilla>, TopLvl=False, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [80 0 0 0 0] 554 0}] is out of scope <no location info>: warning: In the expression: jump $smergeSplit_s3bN ww_s34K ww_s34Q ww_s34R ww_s34S ww_s34T Invalid occurrence of a join variable: $smergeSplit_s3bN The binder is either not a join point, or not valid here }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14650> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#14650: Panic with no extensions (StgCmmEnv: variable not found) -------------------------------------+------------------------------------- Reporter: Zemyla | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: x86_64 Type of failure: Compile-time | (amd64) crash or panic | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by Zemyla): * Attachment "MergeSort.zip" added. .Offending program and full core lint for that file -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14650> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#14650: Panic with no extensions (StgCmmEnv: variable not found) -------------------------------------+------------------------------------- Reporter: Zemyla | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: x86_64 Type of failure: Compile-time | (amd64) crash or panic | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by Zemyla): Oh, I forgot to mention that, when I remove `{-# INLINABLE mergeSplit #-}`, the crash disappears. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14650#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#14650: Panic with no extensions (StgCmmEnv: variable not found) -------------------------------------+------------------------------------- Reporter: Zemyla | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: x86_64 Type of failure: Compile-time | (amd64) crash or panic | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonpj): I'm on this. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14650#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#14650: Panic with no extensions (StgCmmEnv: variable not found) -------------------------------------+------------------------------------- Reporter: Zemyla | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: x86_64 Type of failure: Compile-time | (amd64) crash or panic | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by Simon Peyton Jones <simonpj@…>): In [changeset:"66ff794fedf6e81e727dc8f651e63afe6f2a874b/ghc" 66ff794f/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="66ff794fedf6e81e727dc8f651e63afe6f2a874b" Fix join-point decision This patch moves the "ok_unfolding" test from CoreOpt.joinPointBinding_maybe to OccurAnal.decideJoinPointHood Previously the occurrence analyser was deciding to make something a join point, but the simplifier was reversing that decision, which made the decision about /other/ bindings invalid. Fixes Trac #14650. }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14650#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#14650: Panic with no extensions (StgCmmEnv: variable not found) -------------------------------------+------------------------------------- Reporter: Zemyla | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: x86_64 Type of failure: Compile-time | (amd64) crash or panic | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by Simon Peyton Jones <simonpj@…>): In [changeset:"1c1e46c1292f4ac69275770ed588401535abec45/ghc" 1c1e46c1/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="1c1e46c1292f4ac69275770ed588401535abec45" preInlineUnconditionally is ok for INLINEABLE When debugging Trac #14650, I found a place where we had let {-# INLINEABLE f #-} f = BIG in f 7 but 'f' wasn't getting inlined at its unique call site. There's a good reason for that with INLINE things, which should only inline when saturated, but not for INILNEABLE things. This patch narrows the case where preInlineUnconditionally gives up. It significantly shortens (and improves) the code for #14650. }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14650#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#14650: Panic with no extensions (StgCmmEnv: variable not found) -------------------------------------+------------------------------------- Reporter: Zemyla | Owner: (none) Type: bug | Status: merge Priority: normal | Milestone: Component: Compiler | Version: 8.2.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: x86_64 | (amd64) Type of failure: Compile-time | Test Case: crash or panic | simplCore/should_compile/T14650.hs Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by simonpj): * status: new => merge * testcase: => simplCore/should_compile/T14650.hs Comment: Thanks for a great report. Now fixed. Worth merging "Fix join-point decision". (The other patch doesn't fix an outright bug.) -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14650#comment:5> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#14650: Panic with no extensions (StgCmmEnv: variable not found) -------------------------------------+------------------------------------- Reporter: Zemyla | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: 8.4.1 Component: Compiler | Version: 8.2.2 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: x86_64 | (amd64) Type of failure: Compile-time | Test Case: crash or panic | simplCore/should_compile/T14650.hs Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: merge => closed * resolution: => fixed * milestone: => 8.4.1 Comment: comment:3 merged in 20afdaa75e269697c2f9608e6d29f720a6387d01. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14650#comment:6> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC