[GHC] #8227: cgLookupPanic (probably invalid Core

#8227: cgLookupPanic (probably invalid Core -----------------------------------+--------------------------------------- Reporter: guest | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Keywords: cgLookupPanic | Operating System: MacOS X Architecture: | Type of failure: Compile-time crash Unknown/Multiple | Test Case: Difficulty: Unknown | Blocking: Blocked By: | Related Tickets: | -----------------------------------+--------------------------------------- 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] -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8227 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8227: cgLookupPanic (probably invalid Core ---------------------------------------+----------------------------------- Reporter: guest | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Resolution: | Keywords: cgLookupPanic Operating System: MacOS X | Architecture: Type of failure: Compile-time crash | Unknown/Multiple Test Case: | Difficulty: Unknown Blocking: | Blocked By: | Related Tickets: ---------------------------------------+----------------------------------- Comment (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 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8227#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8227: cgLookupPanic (probably invalid Core ---------------------------------------+----------------------------------- Reporter: guest | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Resolution: fixed | Keywords: cgLookupPanic Operating System: MacOS X | Architecture: Type of failure: Compile-time crash | Unknown/Multiple Test Case: | Difficulty: Unknown Blocking: | Blocked By: | Related Tickets: ---------------------------------------+----------------------------------- Changes (by monoidal): * status: new => closed * resolution: => fixed Comment: 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 }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8227#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8227: cgLookupPanic (probably invalid Core -------------------------------------------------+------------------------- Reporter: guest | Owner: Type: bug | Status: Priority: normal | closed Component: Compiler | Milestone: Resolution: fixed | Version: 7.6.3 Operating System: MacOS X | Keywords: Type of failure: Compile-time crash | cgLookupPanic Test Case: | Architecture: indexed_types/should_fail/T8227 | Unknown/Multiple Blocking: | Difficulty: | Unknown | Blocked By: | Related Tickets: -------------------------------------------------+------------------------- Changes (by simonpj): * testcase: => indexed_types/should_fail/T8227 Old description:
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]
New description: {{{ 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] }}} -- Comment: Thank you! I've added a regression test. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8227#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8227: cgLookupPanic (probably invalid Core
-------------------------------------------------+-------------------------
Reporter: guest | Owner:
Type: bug | Status:
Priority: normal | closed
Component: Compiler | Milestone:
Resolution: fixed | Version: 7.6.3
Operating System: MacOS X | Keywords:
Type of failure: Compile-time crash | cgLookupPanic
Test Case: | Architecture:
indexed_types/should_fail/T8227 | Unknown/Multiple
Blocking: | Difficulty:
| Unknown
| Blocked By:
| Related Tickets:
-------------------------------------------------+-------------------------
Comment (by Simon Peyton Jones
participants (1)
-
GHC