Opened 7 years ago

Closed 7 years ago

#7512 closed bug (worksforme)

GHC crashes with multiple => in instance

Reported by: jvictor Owned by:
Priority: normal Milestone:
Component: Compiler Version: 7.6.1
Keywords: Cc:
Operating System: Linux Architecture: x86_64 (amd64)
Type of failure: Compile-time crash Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


GHC will crash (rather than a syntax error) if you write

import Data.Array.Unboxed

newtype Vector r = Vector (UArray Int r)

instance (IArray UArray r) => (Num r) => Num (Vector r) where
  (Vector v1) + (Vector v2) = Vector $ listArray (0,0) []

This is unfortunately the smallest program I found that crashes the compiler; removing the definition of (+) yields a syntax error as expected.

Change History (1)

comment:1 Changed 7 years ago by simonpj

difficulty: Unknown
Resolution: worksforme
Status: newclosed

Really? With 7.6.1 I get

bash$ c:/fp/ghc-7.6.1/bin/ghc -c T7512.hs

    Malformed instance: IArray UArray r => Num r => Num (Vector r)

GHC 7.4.1 indeed crashes with

bash-3.1$ c:/fp/ghc-7.4.1/bin/ghc -c T7512.hs
ghc.exe: panic! (the 'impossible' happened)
  (GHC version 7.4.1 for i386-unknown-mingw32):
	compiler\rename\RnSource.lhs:429:14-81: Irrefutable pattern failed for pattern Data.Maybe.Just (inst_tyvars,
                                                        SrcLoc.L _ cls,

So I'll close this as already fixed. Re-open if you disagree.


Note: See TracTickets for help on using tickets.