#8893 closed bug (fixed)

-XPolyKinds causes "*** Exception: Prelude.(!!): index too large"

Reported by: ghorn Owned by:
Priority: normal Milestone: 7.8.1
Component: Compiler Version: 7.8.1-rc2
Keywords: PolyKinds Cc: gregmainland@…
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Compile-time crash Test Case: deriving/should_compile/T8893
Blocked By: Blocking:
Related Tickets: Differential Revisions:

Description

The following program will compile fine:

{-# OPTIONS_GHC -Wall #-}
{-# Language DeriveFunctor #-}
--{-# Language PolyKinds #-}

module Bug where

data V a = V [a] deriving Functor

data C x a = C (V (P x a)) deriving Functor

data P x a = P (x a) deriving Functor

But when PolyKinds is enabled, GHC crashes with

$ ghc Bug.hs 
[1 of 1] Compiling Bug              ( Bug.hs, Bug.o )

Bug.hs:9:37:ghc: panic! (the 'impossible' happened)
  (GHC version 7.8.0.20140228 for x86_64-unknown-linux):
	Prelude.(!!): index too large

Change History (7)

comment:1 Changed 16 months ago by ghorn

  • Cc gregmainland@… added

comment:2 Changed 16 months ago by goldfire

Confirmed reproducible in HEAD.

comment:3 Changed 16 months ago by simonpj

Yes I'm on this.

comment:4 Changed 16 months ago by Simon Peyton Jones <simonpj@…>

In ffed708c30f2d1d4b4c5cd08d9c19aeb0bb623ec/ghc:

Apply the kind subst to the (kinds of the) quanitifed tyvars in deriveTyData

I've elaboated Note [Unify kinds in deriving] to explain
what is going on here.

The change fixes Trac #8893.

comment:5 Changed 16 months ago by Simon Peyton Jones <simonpj@…>

comment:6 Changed 16 months ago by simonpj

  • Status changed from new to merge
  • Test Case set to deriving/should_compile/T8893

Thanks for an excellent test case!

Austin, please merge.

Simon

comment:7 Changed 16 months ago by thoughtpolice

  • Milestone set to 7.8.1
  • Resolution set to fixed
  • Status changed from merge to closed

Merged.

Note: See TracTickets for help on using tickets.