Panic when attempting to generate and pretty print Core
This program is supposed to map a term in a small core like language into GHC core, and then pretty print the result. This code (with appropriate changes) worked with 6.6.1, but panics on 6.8.1. To reproduce the bug, simply evaluate 'test' in the 'Test' module. Here is the output from that process:
ghci -v -dcore-lint -package ghc Test.hs
GHCi, version 6.8.1: http://www.haskell.org/ghc/ :? for help
Glasgow Haskell Compiler, Version 6.8.1, for Haskell 98, stage 2 booted by GHC version 6.6.1
Using package config file: /Users/dwm/local/ghc-6.8.1/lib/ghc-6.8.1/package.conf
wired-in package base mapped to base-3.0.0.0
wired-in package rts mapped to rts-1.0
wired-in package haskell98 mapped to haskell98-1.0.1.0
wired-in package template-haskell mapped to template-haskell-2.2.0.0
wired-in package ndp not found.
Hsc static flags: -static
*** Parser:
*** Desugar:
*** Simplify:
*** CorePrep:
*** ByteCodeGen:
Loading package base ... linking ... done.
Loading package old-locale-1.0.0.0 ... linking ... done.
Loading package old-time-1.0.0.0 ... linking ... done.
Loading package filepath-1.1.0.0 ... linking ... done.
Loading package directory-1.0.0.0 ... linking ... done.
Loading package array-0.1.0.0 ... linking ... done.
Loading package containers-0.1.0.0 ... linking ... done.
Loading package hpc-0.5.0.0 ... linking ... done.
Loading package bytestring-0.9.0.1 ... linking ... done.
Loading package pretty-1.0.0.0 ... linking ... done.
Loading package packedstring-0.1.0.0 ... linking ... done.
Loading package template-haskell ... linking ... done.
Loading package unix-2.2.0.0 ... linking ... done.
Loading package process-1.0.0.0 ... linking ... done.
Loading package readline-1.0.1.0 ... linking ... done.
Loading package Cabal-1.2.2.0 ... linking ... done.
Loading package random-1.0.0.0 ... linking ... done.
Loading package haskell98 ... linking ... done.
Loading package ghc-6.8.1 ... linking ... done.
*** Parser:
*** Desugar:
*** Simplify:
*** CorePrep:
*** ByteCodeGen:
*** Parser:
*** Desugar:
*** Simplify:
*** CorePrep:
*** ByteCodeGen:
*** Chasing dependencies:
Chasing modules from:
Stable obj: []
Stable BCO: []
unload: retaining objs []
unload: retaining bcos []
Ready for upsweep []
Upsweep completely successful.
*** Deleting temp files:
Deleting:
*** Chasing dependencies:
Chasing modules from: Test.hs
Stable obj: []
Stable BCO: []
unload: retaining objs []
unload: retaining bcos []
Ready for upsweep
[NONREC
ModSummary {
ms_hs_date = Mon Nov 26 23:34:34 PST 2007
ms_mod = main:Lib.Syntax.LightWeight.Common,
ms_imps = [Data.List]
ms_srcimps = []
},
NONREC
ModSummary {
ms_hs_date = Mon Nov 26 23:35:23 PST 2007
ms_mod = main:Lib.Monad.Reify,
ms_imps = [Lib.Syntax.LightWeight.Common, Unique, Type, TyCon, Id,
DataCon, Data.Map, Data.IORef, Control.Monad.State,
Control.Monad.Reader, Control.Monad.Error, Control.Monad,
Control.Applicative, Data.List, Debug.Trace]
ms_srcimps = []
},
NONREC
ModSummary {
ms_hs_date = Mon Nov 26 23:35:38 PST 2007
ms_mod = main:Lib.Syntax.GHC.Common,
ms_imps = [Lib.Syntax.LightWeight.Common, Lib.Monad.Reify, TypeRep,
Type, TyCon, SrcLoc, OccName, Name, Id, DataCon, CoreSyn,
BasicTypes, Data.Maybe, Data.Map, Control.Monad.State,
Control.Monad.Reader, Control.Applicative, Debug.Trace]
ms_srcimps = []
},
NONREC
ModSummary {
ms_hs_date = Mon Nov 26 23:31:51 PST 2007
ms_mod = main:Lib.Syntax.LightWeight.Core,
ms_imps = [Lib.Syntax.LightWeight.Common]
ms_srcimps = []
},
NONREC
ModSummary {
ms_hs_date = Mon Nov 26 23:31:49 PST 2007
ms_mod = main:Lib.Syntax.GHC.Core,
ms_imps = [Lib.Syntax.LightWeight.Core,
Lib.Syntax.LightWeight.Common, Lib.Syntax.GHC.Common,
Lib.Monad.Reify, Unique, OccName, CoreSyn, Data.Map,
Control.Applicative]
ms_srcimps = []
},
NONREC
ModSummary {
ms_hs_date = Mon Nov 26 23:31:51 PST 2007
ms_mod = main:Main,
ms_imps = [Lib.Syntax.LightWeight.Core,
Lib.Syntax.LightWeight.Common, Lib.Syntax.GHC.Core,
Lib.Syntax.GHC.Common, Lib.Monad.Reify, TypeRep, PprCore,
Outputable, CoreSyn]
ms_srcimps = []
}]
compile: input file Lib/Syntax/LightWeight/Common.hs
*** Checking old interface for main:Lib.Syntax.LightWeight.Common:
[1 of 6] Compiling Lib.Syntax.LightWeight.Common ( Lib/Syntax/LightWeight/Common.hs, interpreted )
*** Parser:
*** Renamer/typechecker:
*** Desugar:
Result size = 2171
*** Core Linted result of Desugar:
*** Simplify:
Result size = 1896
*** Core Linted result of Simplifier phase 0, iteration 1 out of 4:
Result size = 1837
*** Core Linted result of Simplifier phase 0, iteration 2 out of 4:
Result size = 1837
*** Core Linted result of Simplify phase 0 done:
*** Tidy Core:
Result size = 1908
*** Core Linted result of Tidy Core:
*** CorePrep:
Result size = 2286
*** Core Linted result of CorePrep:
*** ByteCodeGen:
*** Deleting temp files:
Deleting:
compile: input file Lib/Monad/Reify.hs
*** Checking old interface for main:Lib.Monad.Reify:
[2 of 6] Compiling Lib.Monad.Reify ( Lib/Monad/Reify.hs, interpreted )
*** Parser:
*** Renamer/typechecker:
*** Desugar:
Result size = 1926
*** Core Linted result of Desugar:
*** Simplify:
Result size = 1743
*** Core Linted result of Simplifier phase 0, iteration 1 out of 4:
Result size = 1618
*** Core Linted result of Simplifier phase 0, iteration 2 out of 4:
Result size = 1618
*** Core Linted result of Simplify phase 0 done:
*** Tidy Core:
Result size = 1697
*** Core Linted result of Tidy Core:
*** CorePrep:
Result size = 1937
*** Core Linted result of CorePrep:
*** ByteCodeGen:
*** Deleting temp files:
Deleting:
compile: input file Lib/Syntax/GHC/Common.hs
*** Checking old interface for main:Lib.Syntax.GHC.Common:
[3 of 6] Compiling Lib.Syntax.GHC.Common ( Lib/Syntax/GHC/Common.hs, interpreted )
*** Parser:
*** Renamer/typechecker:
*** Desugar:
Result size = 950
*** Core Linted result of Desugar:
*** Simplify:
Result size = 960
*** Core Linted result of Simplifier phase 0, iteration 1 out of 4:
Result size = 881
*** Core Linted result of Simplifier phase 0, iteration 2 out of 4:
Result size = 881
*** Core Linted result of Simplify phase 0 done:
*** Tidy Core:
Result size = 881
*** Core Linted result of Tidy Core:
*** CorePrep:
Result size = 993
*** Core Linted result of CorePrep:
*** ByteCodeGen:
*** Deleting temp files:
Deleting:
compile: input file Lib/Syntax/LightWeight/Core.hs
*** Checking old interface for main:Lib.Syntax.LightWeight.Core:
[4 of 6] Compiling Lib.Syntax.LightWeight.Core ( Lib/Syntax/LightWeight/Core.hs, interpreted )
*** Parser:
*** Renamer/typechecker:
*** Desugar:
Result size = 584
*** Core Linted result of Desugar:
*** Simplify:
Result size = 446
*** Core Linted result of Simplifier phase 0, iteration 1 out of 4:
Result size = 454
*** Core Linted result of Simplifier phase 0, iteration 2 out of 4:
Result size = 454
*** Core Linted result of Simplify phase 0 done:
*** Tidy Core:
Result size = 454
*** Core Linted result of Tidy Core:
*** CorePrep:
Result size = 722
*** Core Linted result of CorePrep:
*** ByteCodeGen:
*** Deleting temp files:
Deleting:
compile: input file Lib/Syntax/GHC/Core.hs
*** Checking old interface for main:Lib.Syntax.GHC.Core:
[5 of 6] Compiling Lib.Syntax.GHC.Core ( Lib/Syntax/GHC/Core.hs, interpreted )
*** Parser:
*** Renamer/typechecker:
*** Desugar:
Result size = 1083
*** Core Linted result of Desugar:
*** Simplify:
Result size = 1166
*** Core Linted result of Simplifier phase 0, iteration 1 out of 4:
Result size = 1100
*** Core Linted result of Simplify phase 0 done:
*** Tidy Core:
Result size = 1100
*** Core Linted result of Tidy Core:
*** CorePrep:
Result size = 1261
*** Core Linted result of CorePrep:
*** ByteCodeGen:
*** Deleting temp files:
Deleting:
compile: input file Test.hs
*** Checking old interface for main:Main:
[6 of 6] Compiling Main ( Test.hs, interpreted )
*** Parser:
*** Renamer/typechecker:
*** Desugar:
Result size = 239
*** Core Linted result of Desugar:
*** Simplify:
Result size = 199
*** Core Linted result of Simplifier phase 0, iteration 1 out of 4:
Result size = 199
*** Core Linted result of Simplify phase 0 done:
*** Tidy Core:
Result size = 199
*** Core Linted result of Tidy Core:
*** CorePrep:
Result size = 223
*** Core Linted result of CorePrep:
*** ByteCodeGen:
*** Deleting temp files:
Deleting:
Upsweep completely successful.
*** Deleting temp files:
Deleting:
Ok, modules loaded: Lib.Syntax.LightWeight.Core, Main, Lib.Syntax.LightWeight.Common, Lib.Syntax.GHC.Core, Lib.Syntax.GHC.Common, Lib.Monad.Reify.
*Main> test
*** Parser:
*** Desugar:
*** Simplify:
*** CorePrep:
*** ByteCodeGen:
Loading package mtl-1.1.0.0 ... linking ... done.
let {ghc-6.8.1: panic! (the 'impossible' happened)
(GHC version 6.8.1 for i386-apple-darwin):
a static opt was looked at too early!
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
Trac metadata
Trac field | Value |
---|---|
Version | 6.8.1 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |