[GHC] #12130: ghc: panic! (the 'impossible' happened): find_tycon Block []

#12130: ghc: panic! (the 'impossible' happened): find_tycon Block [] -------------------------------------+------------------------------------- Reporter: jeiea | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Template | Version: 8.0.1 Haskell | Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: Compile-time Unknown/Multiple | crash Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- I just tried building yesod-simple template project with nightly-2016-05-29 snapshot and some extra-deps package, and it seems to fail due to {{{$(widgetFile ...)}}} yesod template haskell clause. It was same on linux and windows, and when I remove handler ghc fails at Application module (and seems also due to template haskell). {{{ ~/yt> stack build ... yt-0.0.0: configure Configuring yt-0.0.0... yt-0.0.0: build Preprocessing library yt-0.0.0... [1 of 9] Compiling Settings ( Settings.hs, .stack- work/dist/x86_64-linux/Cabal-1.24.0.0/build/Settings.o ) [2 of 9] Compiling Settings.StaticFiles ( Settings/StaticFiles.hs, .stack- work/dist/x86_64-linux/Cabal-1.24.0.0/build/Settings/StaticFiles.o ) [3 of 9] Compiling Import.NoFoundation ( Import/NoFoundation.hs, .stack- work/dist/x86_64-linux/Cabal-1.24.0.0/build/Import/NoFoundation.o ) [4 of 9] Compiling Foundation ( Foundation.hs, .stack- work/dist/x86_64-linux/Cabal-1.24.0.0/build/Foundation.o ) [5 of 9] Compiling Import ( Import.hs, .stack- work/dist/x86_64-linux/Cabal-1.24.0.0/build/Import.o ) [6 of 9] Compiling Handler.Common ( Handler/Common.hs, .stack- work/dist/x86_64-linux/Cabal-1.24.0.0/build/Handler/Common.o ) [7 of 9] Compiling Handler.Home ( Handler/Home.hs, .stack- work/dist/x86_64-linux/Cabal-1.24.0.0/build/Handler/Home.o ) ghc: panic! (the 'impossible' happened) (GHC version 8.0.1 for x86_64-unknown-linux): find_tycon Block [] Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug Completed 179 action(s). -- While building package yt-0.0.0 using: /home/jeiea/.stack/setup-exe-cache/x86_64-linux/setup-Simple- Cabal-1.24.0.0-ghc-8.0.1 --builddir=.stack- work/dist/x86_64-linux/Cabal-1.24.0.0 build lib:yt exe:yt --ghc-options " -ddump-hi -ddump-to-file" Process exited with code: ExitFailure 1 }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12130 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12130: ghc: panic! (the 'impossible' happened): find_tycon Block [] -------------------------------------+------------------------------------- Reporter: jeiea | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Template Haskell | Version: 8.0.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time | Unknown/Multiple crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by jeiea): * Attachment "yesod-simple.zip" added. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12130 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12130: ghc: panic! (the 'impossible' happened): find_tycon Block [] -------------------------------------+------------------------------------- Reporter: jeiea | Owner: Type: bug | Status: new Priority: high | Milestone: Component: Template Haskell | Version: 8.0.1 Resolution: | Keywords: | DisambiguateRecordFields Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time | Unknown/Multiple crash | Test Case: Blocked By: | Blocking: Related Tickets: #11228 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by thomie): * priority: normal => high * cc: adamgundry (added) * related: => #11228 * keywords: => DisambiguateRecordFields Comment: Regression from 7.10. Here is a reproducer: A.hs: {{{#!hs {-# Language TemplateHaskell #-} {-# Language DisambiguateRecordFields #-} -- DisambiguateRecordFields (or RecordWildCards) is necessary -- to trigger the bug. module A where import B hiding (Block) -- Hiding "Block" is necessary to trigger the bug. b = $(block) {- ghc: panic! (the 'impossible' happened) (GHC version 8.0.1 for x86_64-unknown-linux): find_tycon Block [] -} }}} B.hs: {{{#!hs {-# LANGUAGE TemplateHaskell #-} module B where import Language.Haskell.TH data Block = Block { blockSelector :: () } block :: Q Exp block = [| Block { -- Using record syntax is neccesary to trigger the bug. blockSelector = () } |] }}} CC adamgundry, as he was the last to touch `find_tycon`. The discussion in ticket:11228#comment:4 seems relevant. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12130#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12130: ghc: panic! (the 'impossible' happened): find_tycon Block [] -------------------------------------+------------------------------------- Reporter: jeiea | Owner: Type: bug | Status: new Priority: high | Milestone: 8.0.2 Component: Template Haskell | Version: 8.0.1 Resolution: | Keywords: | DisambiguateRecordFields Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time | Unknown/Multiple crash | Test Case: Blocked By: | Blocking: Related Tickets: #11228 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by thomie): * milestone: => 8.0.2 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12130#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12130: ghc: panic! (the 'impossible' happened): find_tycon Block [] -------------------------------------+------------------------------------- Reporter: jeiea | Owner: Type: bug | Status: patch Priority: high | Milestone: 8.0.2 Component: Template Haskell | Version: 8.0.1 Resolution: | Keywords: | DisambiguateRecordFields Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time | Unknown/Multiple crash | Test Case: th/T12130 Blocked By: | Blocking: Related Tickets: #11228 | Differential Rev(s): Phab:D2321 Wiki Page: | -------------------------------------+------------------------------------- Changes (by adamgundry): * status: new => patch * testcase: => th/T12130 * differential: => Phab:D2321 Comment: Thanks for the great test case! It turns out this bug was lingering already in 7.10, but laziness meant we didn't hit the panic by sheer luck. Simple fix: replace the panic with `Nothing`, which is reasonable in this context: if the datacon isn't in scope, don't use it for disambiguating record fields. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12130#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12130: ghc: panic! (the 'impossible' happened): find_tycon Block [] -------------------------------------+------------------------------------- Reporter: jeiea | Owner: adamgundry Type: bug | Status: patch Priority: high | Milestone: 8.0.2 Component: Template Haskell | Version: 8.0.1 Resolution: | Keywords: | DisambiguateRecordFields Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time | Unknown/Multiple crash | Test Case: th/T12130 Blocked By: | Blocking: Related Tickets: #11228 | Differential Rev(s): Phab:D2321 Wiki Page: | -------------------------------------+------------------------------------- Changes (by adamgundry): * owner: => adamgundry -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12130#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12130: ghc: panic! (the 'impossible' happened): find_tycon Block []
-------------------------------------+-------------------------------------
Reporter: jeiea | Owner: adamgundry
Type: bug | Status: patch
Priority: high | Milestone: 8.0.2
Component: Template Haskell | Version: 8.0.1
Resolution: | Keywords:
| DisambiguateRecordFields
Operating System: Unknown/Multiple | Architecture:
Type of failure: Compile-time | Unknown/Multiple
crash | Test Case: th/T12130
Blocked By: | Blocking:
Related Tickets: #11228 | Differential Rev(s): Phab:D2321
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Ben Gamari

#12130: ghc: panic! (the 'impossible' happened): find_tycon Block [] -------------------------------------+------------------------------------- Reporter: jeiea | Owner: adamgundry Type: bug | Status: merge Priority: high | Milestone: 8.0.2 Component: Template Haskell | Version: 8.0.1 Resolution: | Keywords: | DisambiguateRecordFields Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time | Unknown/Multiple crash | Test Case: th/T12130 Blocked By: | Blocking: Related Tickets: #11228 | Differential Rev(s): Phab:D2321 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: patch => merge Comment: Seems like a good candidate for 8.0.2. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12130#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12130: ghc: panic! (the 'impossible' happened): find_tycon Block []
-------------------------------------+-------------------------------------
Reporter: jeiea | Owner: adamgundry
Type: bug | Status: merge
Priority: high | Milestone: 8.0.2
Component: Template Haskell | Version: 8.0.1
Resolution: | Keywords:
| DisambiguateRecordFields
Operating System: Unknown/Multiple | Architecture:
Type of failure: Compile-time | Unknown/Multiple
crash | Test Case: th/T12130
Blocked By: | Blocking:
Related Tickets: #11228 | Differential Rev(s): Phab:D2321
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Simon Peyton Jones

#12130: ghc: panic! (the 'impossible' happened): find_tycon Block [] -------------------------------------+------------------------------------- Reporter: jeiea | Owner: adamgundry Type: bug | Status: closed Priority: high | Milestone: 8.0.2 Component: Template Haskell | Version: 8.0.1 Resolution: fixed | Keywords: | DisambiguateRecordFields Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time | Unknown/Multiple crash | Test Case: th/T12130 Blocked By: | Blocking: Related Tickets: #11228 | Differential Rev(s): Phab:D2321 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: merge => closed * resolution: => fixed Comment: Merged to `ghc-8.0` as 206ac693372d00b59eb98c34b801906c5e7bedfc. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12130#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12130: ghc: panic! (the 'impossible' happened): find_tycon Block [] -------------------------------------+------------------------------------- Reporter: jeiea | Owner: adamgundry Type: bug | Status: closed Priority: high | Milestone: 8.0.2 Component: Template Haskell | Version: 8.0.1 Resolution: fixed | Keywords: | DisambiguateRecordFields Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time | Unknown/Multiple crash | Test Case: th/T12130 Blocked By: | Blocking: Related Tickets: #11228 | Differential Rev(s): Phab:D2321 Wiki Page: | -------------------------------------+------------------------------------- Comment (by spl): For others who happen upon this problem with GHC 8.0.1, I've used the following workaround. In each module where the error occurs, add ```{-# LANGUAGE NoDisambiguateRecordFields NoRecordWildCards #-}``` and remove all uses of disambiguated fields and record wildcards from that module. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12130#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC