[GHC] #14080: GHC panic while forcing the thunk for TyThing IsFile (regression)

#14080: GHC panic while forcing the thunk for TyThing IsFile (regression) -------------------------------------+------------------------------------- Reporter: inaki | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1 Keywords: hs-boot | Operating System: Unknown/Multiple Architecture: | Type of failure: Compile-time Unknown/Multiple | crash or panic Test Case: | Blocked By: Blocking: | Related Tickets: #13803, #13981 Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- Consider the following set of files: {{{#!hs -- A.hs {-# LANGUAGE KindSignatures #-} {-# LANGUAGE TypeFamilies #-} module A (AI(..)) where import GHC.Exts (Constraint) class AI (info :: *) where type S info :: * -> Constraint }}} {{{#!hs -- C.hs module C () where import {-# SOURCE #-} qualified OC as OC import {-# SOURCE #-} qualified OV as OV }}} {{{#!hs -- IF.hs module IF where import qualified C as C import {-# SOURCE #-} qualified OF as OF class IsF o }}} {{{#!hs -- IF.hs-boot module IF where class IsF o }}} {{{#!hs -- OC.hs {-# LANGUAGE DataKinds #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE EmptyDataDecls #-} module OC () where import A (AI(..)) data I instance AI I where type S I = (~) () }}} {{{#!hs -- OC.hs-boot module OC where }}} {{{#!hs -- OF.hs {-# LANGUAGE DataKinds #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE EmptyDataDecls #-} module OF () where import A (AI(..)) import {-# SOURCE #-} qualified IF as IF data P instance AI P where type S P = IF.IsF }}} {{{#!hs -- OF.hs-boot module OF where }}} {{{#!hs -- OV.hs module OV () where }}} {{{#!hs -- OV.hs-boot module OV where }}} This works with `ghc-8.0.2` and earlier versions, but fails with `ghc-8.2.1`. When I run `ghc IF` for `8.2.1` I get {{{ [ 1 of 10] Compiling A ( A.hs, A.o ) [ 2 of 10] Compiling IF[boot] ( IF.hs-boot, IF.o-boot ) [ 3 of 10] Compiling OC[boot] ( OC.hs-boot, OC.o-boot ) [ 4 of 10] Compiling OC ( OC.hs, OC.o ) [ 5 of 10] Compiling OF[boot] ( OF.hs-boot, OF.o-boot ) [ 6 of 10] Compiling OF ( OF.hs, OF.o ) [ 7 of 10] Compiling OV[boot] ( OV.hs-boot, OV.o-boot ) [ 8 of 10] Compiling C ( C.hs, C.o ) [ 9 of 10] Compiling IF ( IF.hs, IF.o ) ghc-stage2: panic! (the 'impossible' happened) (GHC version 8.2.1 for x86_64-unknown-linux): tcIfaceGlobal (local): not found You are in a maze of twisty little passages, all alike. While forcing the thunk for TyThing IsF which was lazily initialized by initIfaceCheck typecheckLoop, I tried to tie the knot, but I couldn't find IsF in the current type environment. If you are developing GHC, please read Note [Tying the knot] and Note [Type-checking inside the knot]. Consider rebuilding GHC with profiling for a better stack trace. Contents of current type environment: [] 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/iface/TcIface.hs:1696:23 in ghc:TcIface Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug }}} For context, this is a minimal testcase of the panic reported in #13803 for `gi-gio`, which persists after fixing the panic in the minimal testcase in ticket:13803#comment:9. (It seems like the original code was hitting more than one issue.) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14080 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14080: GHC panic while forcing the thunk for TyThing IsFile (regression) -------------------------------------+------------------------------------- Reporter: inaki | Owner: (none) Type: bug | Status: new Priority: high | Milestone: 8.2.2 Component: Compiler | Version: 8.2.1 Resolution: | Keywords: hs-boot Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time | Unknown/Multiple crash or panic | Test Case: Blocked By: | Blocking: Related Tickets: #13803, #13981 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * cc: ezyang (added) * priority: normal => high * milestone: => 8.2.2 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14080#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14080: GHC panic while forcing the thunk for TyThing IsFile (regression) -------------------------------------+------------------------------------- Reporter: inaki | Owner: (none) Type: bug | Status: infoneeded Priority: high | Milestone: 8.2.2 Component: Compiler | Version: 8.2.1 Resolution: | Keywords: hs-boot Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time | Unknown/Multiple crash or panic | Test Case: Blocked By: | Blocking: Related Tickets: #13803, #13981 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by ezyang): * status: new => infoneeded Comment: I can reproduce on 8.2.1, and I cannot reproduce on HEAD. I did test with my fix for #14075 so you may need to apply it (though I also tried with another random HEAD build I had lying around, and it was fine.) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14080#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14080: GHC panic while forcing the thunk for TyThing IsFile (regression) -------------------------------------+------------------------------------- Reporter: inaki | Owner: (none) Type: bug | Status: infoneeded Priority: high | Milestone: 8.2.2 Component: Compiler | Version: 8.2.1 Resolution: | Keywords: hs-boot Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time | Unknown/Multiple crash or panic | Test Case: Blocked By: | Blocking: Related Tickets: #13803, #13981 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by inaki): I just checked on HEAD, and the panic is not there anymore (with or without the fix to #14075). For the tip of the `8.2` branch, the panic is there with or without the fix to #14075. Interestingly, the panic when building `gi-gio` originally reported in #13803 is gone in HEAD if I include the fix to #14075 (otherwise it is still present). This is great! So I wonder if it is possible to backport to the `8.2` branch whatever fixed this in HEAD? Or alternatively, can you see any way of working around the panic reported above with `8.2`? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14080#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14080: GHC panic while forcing the thunk for TyThing IsFile (regression) -------------------------------------+------------------------------------- Reporter: inaki | Owner: (none) Type: bug | Status: infoneeded Priority: high | Milestone: 8.2.2 Component: Compiler | Version: 8.2.1 Resolution: | Keywords: hs-boot Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time | Unknown/Multiple crash or panic | Test Case: Blocked By: | Blocking: Related Tickets: #13803, #13981 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by ezyang): The most relevant commit from me that might be how HEAD fixed it is 9e9fb57c37c62bb6c90f15b173c5d3632121c66a. If this commit isn't the needed one, more sleuthing will be needed. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14080#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14080: GHC panic while forcing the thunk for TyThing IsFile (regression) -------------------------------------+------------------------------------- Reporter: inaki | Owner: (none) Type: bug | Status: infoneeded Priority: high | Milestone: 8.2.2 Component: Compiler | Version: 8.2.1 Resolution: | Keywords: hs-boot Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time | Unknown/Multiple crash or panic | Test Case: Blocked By: | Blocking: Related Tickets: #13803, #13981 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by inaki): That didn't work, unfortunately. If you have any other suggestion I would be glad to try, otherwise I will start bisecting... -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14080#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14080: GHC panic while forcing the thunk for TyThing IsFile (regression) -------------------------------------+------------------------------------- Reporter: inaki | Owner: (none) Type: bug | Status: infoneeded Priority: high | Milestone: 8.2.2 Component: Compiler | Version: 8.2.1 Resolution: | Keywords: hs-boot Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time | Unknown/Multiple crash or panic | Test Case: Blocked By: | Blocking: Related Tickets: #13803, #13981 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by ezyang): I skimmed the commits but nothing popped out. I guess it's bisect time... -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14080#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14080: GHC panic while forcing the thunk for TyThing IsFile (regression) -------------------------------------+------------------------------------- Reporter: inaki | Owner: (none) Type: bug | Status: infoneeded Priority: high | Milestone: 8.2.2 Component: Compiler | Version: 8.2.1 Resolution: | Keywords: hs-boot Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time | Unknown/Multiple crash or panic | Test Case: Blocked By: | Blocking: Related Tickets: #13803, #13981 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by inaki): I just finished bisecting, the commit that removes the panic is 69d9081d9fa3ff36fda36e4e11ef7e8f946ecf2a. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14080#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14080: GHC panic while forcing the thunk for TyThing IsFile (regression) -------------------------------------+------------------------------------- Reporter: inaki | Owner: (none) Type: bug | Status: infoneeded Priority: high | Milestone: 8.2.2 Component: Compiler | Version: 8.2.1 Resolution: | Keywords: hs-boot Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time | Unknown/Multiple crash or panic | Test Case: Blocked By: | Blocking: Related Tickets: #13803, #13981 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by ezyang): OK, that makes sense, but disappointingly, it may mean the underlying bug is still lurking, but under a different repro. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14080#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14080: GHC panic while forcing the thunk for TyThing IsFile (regression) -------------------------------------+------------------------------------- Reporter: inaki | Owner: (none) Type: bug | Status: infoneeded Priority: high | Milestone: 8.2.2 Component: Compiler | Version: 8.2.1 Resolution: | Keywords: hs-boot Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time | Unknown/Multiple crash or panic | Test Case: Blocked By: | Blocking: Related Tickets: #13803, #13981 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by inaki): That seems to be indeed the case. I cherry picked this commit (together with some related ones, as detailed in [ticket:13719#comment:8]) into the `8.2` branch. This got rid of the issue reported here, but the original issue in #13803, `ghc` panicking when building `gi-gio`, is still there... Sigh. Now I am not sure how to proceed. I can try to reduce the panic with the patches above applied to the `8.2` branch, and file yet another issue. Would that be the best way to proceed? Or should I reopen the original #13803? In either case the whole process of reducing and bisecting is extremely time consuming, I would really appreciate some guidance (even if it is just a guess). -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14080#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14080: GHC panic while forcing the thunk for TyThing IsFile (regression) -------------------------------------+------------------------------------- Reporter: inaki | Owner: (none) Type: bug | Status: infoneeded Priority: high | Milestone: 8.2.2 Component: Compiler | Version: 8.2.1 Resolution: | Keywords: hs-boot Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time | Unknown/Multiple crash or panic | Test Case: Blocked By: | Blocking: Related Tickets: #13803, #13981 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by ezyang): Thank you for the hard work inaki. Probably what is left to do now is someone (e.g., me) to do a full build with gi-gio and debug from there. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14080#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14080: GHC panic while forcing the thunk for TyThing IsFile (regression) -------------------------------------+------------------------------------- Reporter: inaki | Owner: (none) Type: bug | Status: infoneeded Priority: high | Milestone: 8.2.2 Component: Compiler | Version: 8.2.1 Resolution: | Keywords: hs-boot Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time | Unknown/Multiple crash or panic | Test Case: Blocked By: | Blocking: Related Tickets: #13803, #13981 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by _deepfire): Edward, this bug is marked `infoneeded`, which seems to put it in a dangerous category, but is it really warranted? Sorry for meddling, just another worried user stuck on this.. : -) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14080#comment:11 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14080: GHC panic while forcing the thunk for TyThing IsFile (regression) -------------------------------------+------------------------------------- Reporter: inaki | Owner: (none) Type: bug | Status: closed Priority: high | Milestone: 8.2.2 Component: Compiler | Version: 8.2.1 Resolution: duplicate | Keywords: hs-boot Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time | Unknown/Multiple crash or panic | Test Case: Blocked By: | Blocking: Related Tickets: #13803, #13981, | Differential Rev(s): #14382 | Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: infoneeded => closed * resolution: => duplicate * related: #13803, #13981 => #13803, #13981, #14382 Comment: A dangerous category indeed. This was also reported as #14382. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14080#comment:12 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC