[GHC] #7878: Panic when using DerivingGeneric with hs-boot
#7878: Panic when using DerivingGeneric with hs-boot -------------------------------+-------------------------------------------- Reporter: ryant5000 | Owner: Type: bug | Status: new Priority: normal | Component: Compiler Version: 7.6.3 | Keywords: Os: Linux | Architecture: x86_64 (amd64) Failure: Compile-time crash | Blockedby: Blocking: | Related: -------------------------------+-------------------------------------------- When a module that uses DerivingGeneric has an hs-boot file, a panic like the following results: ghc: panic! (the 'impossible' happened) (GHC version 7.6.3 for x86_64-unknown-linux): tcIfaceGlobal (local): not found: main:A.D1Test{tc apn} [(roo,ghc: panic! (the 'impossible' happened) (GHC version 7.6.3 for x86_64-unknown-linux): ghc: panic! (the 'impossible' happened) (GHC version 7.6.3 for x86_64-unknown-linux): tcIfaceGlobal (local): not found: The attached files demonstrate the issue. To reproduce, run 'ghc --make C'. Note that running the same command a second time will not cause the error, unless *.hi* files are deleted. -- Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7878> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#7878: Panic when using DerivingGeneric with hs-boot -------------------------------+-------------------------------------------- Reporter: ryant5000 | Owner: Type: bug | Status: new Priority: normal | Component: Compiler Version: 7.6.3 | Keywords: Os: Linux | Architecture: x86_64 (amd64) Failure: Compile-time crash | Blockedby: Blocking: | Related: -------------------------------+-------------------------------------------- Comment(by ryant5000): It appears that using DerivingGeneric in other files in the cycle, even if they don't themselves use hs-boot files, also sometimes causes this problem, but not always. -- Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7878#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#7878: Panic when using DerivingGeneric with hs-boot -------------------------------+-------------------------------------------- Reporter: ryant5000 | Owner: dreixel Type: bug | Status: new Priority: normal | Component: Compiler Version: 7.7 | Keywords: Os: Linux | Architecture: x86_64 (amd64) Failure: Compile-time crash | Blockedby: Blocking: | Related: -------------------------------+-------------------------------------------- Changes (by dreixel): * owner: => dreixel * version: 7.6.3 => 7.7 Comment: Confirmed with HEAD. Thanks for reporting; I'll take a look. -- Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7878#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#7878: Panic when using DerivingGeneric with hs-boot -------------------------------+-------------------------------------------- Reporter: ryant5000 | Owner: dreixel Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.7 Keywords: | Os: Linux Architecture: x86_64 (amd64) | Failure: Compile-time crash Difficulty: Unknown | Testcase: Blockedby: | Blocking: Related: | -------------------------------+-------------------------------------------- Changes (by simonpj): * difficulty: => Unknown Old description:
When a module that uses DerivingGeneric has an hs-boot file, a panic like the following results:
ghc: panic! (the 'impossible' happened) (GHC version 7.6.3 for x86_64-unknown-linux): tcIfaceGlobal (local): not found: main:A.D1Test{tc apn} [(roo,ghc: panic! (the 'impossible' happened) (GHC version 7.6.3 for x86_64-unknown-linux): ghc: panic! (the 'impossible' happened) (GHC version 7.6.3 for x86_64-unknown-linux): tcIfaceGlobal (local): not found:
The attached files demonstrate the issue. To reproduce, run 'ghc --make C'. Note that running the same command a second time will not cause the error, unless *.hi* files are deleted.
New description: When a module that uses `DerivingGeneric` has an hs-boot file, a panic like the following results: {{{ ghc: panic! (the 'impossible' happened) (GHC version 7.6.3 for x86_64-unknown-linux): tcIfaceGlobal (local): not found: main:A.D1Test{tc apn} [(roo,ghc: panic! (the 'impossible' happened) (GHC version 7.6.3 for x86_64-unknown-linux): ghc: panic! (the 'impossible' happened) (GHC version 7.6.3 for x86_64-unknown-linux): tcIfaceGlobal (local): not found: }}} The attached files demonstrate the issue. To reproduce, run `ghc --make C`. Note that running the same command a second time will not cause the error, unless `*.hi*` files are deleted. -- -- Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7878#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#7878: Panic when using DerivingGeneric with hs-boot -------------------------------+-------------------------------------------- Reporter: ryant5000 | Owner: dreixel Type: bug | Status: patch Priority: normal | Milestone: Component: Compiler | Version: 7.7 Keywords: | Os: Linux Architecture: x86_64 (amd64) | Failure: Compile-time crash Difficulty: Unknown | Testcase: Blockedby: | Blocking: Related: | -------------------------------+-------------------------------------------- Changes (by parcs): * status: new => patch Comment: I think I have a solution (attached): `genGenericMetaTyCons` creates new top-level external names but it doesn't populate the name cache with them. Creating the names with `newGlobalBinder`, which in turn updates the name cache, fixes this issue (and still passes the testsuite). Though I don't know whether this is the correct solution. -- Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7878#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#7878: Panic when using DerivingGeneric with hs-boot -------------------------------+-------------------------------------------- Reporter: ryant5000 | Owner: dreixel Type: bug | Status: patch Priority: normal | Milestone: Component: Compiler | Version: 7.7 Keywords: | Os: Linux Architecture: x86_64 (amd64) | Failure: Compile-time crash Difficulty: Unknown | Testcase: Blockedby: | Blocking: Related: | -------------------------------+-------------------------------------------- Comment(by simonpj): Yes, I think that's the right solution. See the documentation of `External` names in [wiki:Commentary/Compiler/NameType]. I'll add a note with `IfaceEnv.newGlobalBinder`. Simon -- Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7878#comment:5> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#7878: Panic when using DerivingGeneric with hs-boot -------------------------------+-------------------------------------------- Reporter: ryant5000 | Owner: dreixel Type: bug | Status: patch Priority: normal | Milestone: Component: Compiler | Version: 7.7 Keywords: | Os: Linux Architecture: x86_64 (amd64) | Failure: Compile-time crash Difficulty: Unknown | Testcase: Blockedby: | Blocking: Related: | -------------------------------+-------------------------------------------- Comment(by patrick@…): commit ad1bc9dcc67d7c0d51fa2c71e8188c79ce3ebb1e {{{ Author: Patrick Palka <patrick@parcs.ath.cx> Date: Sun May 5 22:41:27 2013 -0400 Update the name cache when creating new names via DeriveGeneric New external top-level names were being created but the name cache wasn't being populated, leading to #7878. Signed-off-by: Jose Pedro Magalhaes <jpm@cs.ox.ac.uk> compiler/typecheck/TcGenGenerics.lhs | 32 +++++++++++--------------------- 1 files changed, 11 insertions(+), 21 deletions(-) }}} -- Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7878#comment:6> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#7878: Panic when using DerivingGeneric with hs-boot ---------------------------------+------------------------------------------ Reporter: ryant5000 | Owner: dreixel Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.7 Resolution: fixed | Keywords: Os: Linux | Architecture: x86_64 (amd64) Failure: Compile-time crash | Difficulty: Unknown Testcase: | Blockedby: Blocking: | Related: ---------------------------------+------------------------------------------ Changes (by dreixel): * status: patch => closed * resolution: => fixed Comment: Thanks; patch applied, testcase T7878 added. -- Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7878#comment:7> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#7878: Panic when using DerivingGeneric with hs-boot ---------------------------------+------------------------------------------ Reporter: ryant5000 | Owner: dreixel Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.7 Resolution: fixed | Keywords: Os: Linux | Architecture: x86_64 (amd64) Failure: Compile-time crash | Difficulty: Unknown Testcase: | Blockedby: Blocking: | Related: ---------------------------------+------------------------------------------ Comment(by ryant5000): Thanks! I've verified that this patch fixes the issue in several more complex test cases as well. -- Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7878#comment:8> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#7878: Panic when using DerivingGeneric with hs-boot ---------------------------------+------------------------------------------ Reporter: ryant5000 | Owner: dreixel Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.7 Resolution: fixed | Keywords: Os: Linux | Architecture: x86_64 (amd64) Failure: Compile-time crash | Difficulty: Unknown Testcase: generics/T7878 | Blockedby: Blocking: | Related: ---------------------------------+------------------------------------------ Changes (by simonpj): * testcase: => generics/T7878 -- Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7878#comment:9> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC