Opened 8 months ago

Closed 8 months ago

Last modified 8 months ago

#13071 closed bug (duplicate)

GHCi 8.0.1 panic with PatternSynonyms

Reported by: taktoa Owned by:
Priority: normal Milestone:
Component: GHCi Version: 8.0.1
Keywords: PatternSynonyms Cc: cactus
Operating System: Linux Architecture: Unknown/Multiple
Type of failure: GHCi crash Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

Loading this code:

{-# LANGUAGE PatternSynonyms #-}

data D1 = MkD1 ()
data D2 = MkD2 D1

pattern P1 x = MkD1 x
pattern P2 x = MkD2 (P1 x)

in GHCi 8.0.1 results in the following panic:

$ ghci Broken.hs         
GHCi, version 8.0.1: http://www.haskell.org/ghc/  :? for help
[1 of 1] Compiling Main             ( Broken.hs, interpreted )
ghc: panic! (the 'impossible' happened)
  (GHC version 8.0.1 for x86_64-unknown-linux):
	kindPrimRep.go rep_a18s

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

> 

The unique name in the error message (rep_a18s) seems to be consistent between executions, but varies after :reloading.

The panic does not occur when the module is simply compiled with ghc; it only occurs when loaded into ghci.

According to ​Gergő Érdi, who is CCed, the error does not occur in GHCi 7.10.3

Change History (7)

comment:1 Changed 8 months ago by cactus

We can simplify the code even further, and still have it crash GHCi:

{-# LANGUAGE PatternSynonyms #-}

data D1 = MkD1
data D2 = MkD2 D1

pattern P1 = MkD1
pattern P2 = MkD2 P1

comment:3 Changed 8 months ago by simonpj

Yes, pls check with 8.0.2. Thanks.

comment:4 Changed 8 months ago by taktoa

I don't have easy access to GHC 8.0.2 (I'm on NixOS), but I tried it with GHC HEAD and the problem seems to be solved:

~ $ /nix/store/0sww5ii70bn8b8w3g8lszqn7pwxl4axs-ghc-8.1.20160930/bin/ghci Broken.hs 
GHCi, version 8.1.20160930: http://www.haskell.org/ghc/  :? for help
[1 of 1] Compiling Main             ( Broken.hs, interpreted )
Ok, modules loaded: Main.
*Main> 
Leaving GHCi.

comment:5 Changed 8 months ago by taktoa

Resolution: duplicate
Status: newclosed

comment:6 Changed 8 months ago by mpickering

I am fairly certain this is solved in 8.0.2 as well.

The 8.0.2 release candidate is on nixpkgs if you want to try, the attribute name is haskell.compiler.ghc802.

comment:7 Changed 8 months ago by RyanGlScott

I can confirm it's fixed in 8.0.2:

$ /opt/ghc/8.0.2/bin/ghci Bug.hs
GHCi, version 8.0.1.20161213: http://www.haskell.org/ghc/  :? for help
Loaded GHCi configuration from /home/rgscott/.ghci
[1 of 1] Compiling Main             ( Bug.hs, interpreted )
Ok, modules loaded: Main.
Note: See TracTickets for help on using tickets.