Opened 10 months ago

Closed 10 months ago

Last modified 10 months ago

#8227 closed bug (fixed)

cgLookupPanic (probably invalid Core

Reported by: guest Owned by:
Priority: normal Milestone:
Component: Compiler Version: 7.6.3
Keywords: cgLookupPanic Cc:
Operating System: MacOS X Architecture: Unknown/Multiple
Type of failure: Compile-time crash Difficulty: Unknown
Test Case: indexed_types/should_fail/T8227 Blocked By:
Blocking: Related Tickets:

Description (last modified by simonpj)

ghc: panic! (the 'impossible' happened)
  (GHC version 7.6.3 for x86_64-apple-darwin):
	cgLookupPanic (probably invalid Core; try -dcore-lint)
    cobox{v a34t} [lid]

Attachments (1)

Parametric.hs (12.5 KB) - added by guest 10 months ago.

Download all attachments as: .zip

Change History (5)

Changed 10 months ago by guest

comment:1 Changed 10 months ago by simonpj

Could someone try with HEAD? If there is a similar failure, try -dcore-lint.

I'm not sure whether this failure show up when compiling the diagrams package, or in some other way. More info on how to reproduce would be very helpful.

Thanks

Simon

comment:2 Changed 10 months ago by monoidal

  • Resolution set to fixed
  • Status changed from new to closed

I distilled the part that causes panic in 7.6.3 and that part gives a correct type error in HEAD.

The crucial part is this:

arcLengthToParam :: Scalar (V p) -> p -> Scalar (V p) -> Scalar (V p)

absoluteToParam :: Scalar (V a) -> a -> Scalar (V a) -> Scalar (V a)
absoluteToParam eps seg len  = arcLengthToParam eps (arcLength eps seg - len)

-- You probably wanted
absoluteToParam eps seg len  = arcLengthToParam eps seg (arcLength eps seg - len)

By skipping this parameter GHC has to solve Scalar (V a) ~ a and Scalar (V a) -> Scalar (V p) ~ Scalar (V p) and gets a headache. Here's a selfcontained test that panicks 7.6.3 gives occurs check in HEAD:

{-# LANGUAGE TypeFamilies #-}
module V where
type family V a :: *

type instance V Double    = Double
type instance V (a -> b)   = V b

{-# LANGUAGE TypeFamilies #-}
module Parametric
  ( 
    absoluteToParam
  ) where

import V

type family Scalar a :: *
type instance Scalar (a -> v) = a -> Scalar v

arcLengthToParam :: Scalar (V p) -> p -> Scalar (V p) -> Scalar (V p)
arcLengthToParam = undefined

absoluteToParam :: Scalar (V a) -> a -> Scalar (V a)
absoluteToParam eps seg = arcLengthToParam eps eps

comment:3 Changed 10 months ago by simonpj

  • Description modified (diff)
  • Test Case set to indexed_types/should_fail/T8227

Thank you! I've added a regression test.

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

Note: See TracTickets for help on using tickets.