[GHC] #1323: crash when zipping two lists of the same length...
GHC
trac at galois.com
Fri May 4 03:50:31 EDT 2007
#1323: crash when zipping two lists of the same length...
--------------------------------------+-------------------------------------
Reporter: matthew at wellquite.org | Owner:
Type: bug | Status: closed
Priority: normal | Milestone:
Component: Compiler | Version: 6.6
Severity: normal | Resolution: wontfix
Keywords: | Difficulty: Unknown
Os: Linux | Testcase: Session.hs
Architecture: x86_64 (amd64) |
--------------------------------------+-------------------------------------
Changes (by simonpj):
* resolution: => wontfix
* testcase: => Session.hs
* status: new => closed
Old description:
> I've personally not checked this against 6.6.1, but "mauke" on #haskell
> says the same crash and same line number appears in the crash report.
>
> $ ghc --version
> The Glorious Glasgow Haskell Compilation System, version 6.6
>
> $ ghc -v --make Session.hs
> Glasgow Haskell Compiler, Version 6.6, for Haskell 98, compiled by GHC
> version 6.6
> Using package config file: /usr/lib/ghc-6.6/package.conf
> hiding package hinstaller-2007.4.21 to avoid conflict with later version
> hinstaller-2007.4.24
> wired-in package base mapped to base-2.0
> wired-in package rts mapped to rts-1.0
> wired-in package haskell98 mapped to haskell98-1.0
> wired-in package template-haskell mapped to template-haskell-2.0
> Hsc static flags: -static
> *** Chasing dependencies:
> Chasing modules from: Session.hs
> Stable obj: []
> Stable BCO: []
> compile: input file Session.hs
> Created temporary directory: /tmp/ghc4588_0
> *** Checking old interface for main:Main:
> [1 of 1] Compiling Main ( Session.hs, Session.o )
> *** Parser:
> *** Renamer/typechecker:
> *** Desugar:
> Result size = 379
> *** Simplify:
> *** Deleting temp files:
> Deleting: /tmp/ghc4588_0/ghc4588_0.s
> Warning: deleting non-existent /tmp/ghc4588_0/ghc4588_0.s
> *** Deleting temp dirs:
> Deleting: /tmp/ghc4588_0
> ghc-6.6: panic! (the 'impossible' happened)
> (GHC version 6.6 for x86_64-unknown-linux):
> Pattern match failure in do expression at
> simplCore/Simplify.lhs:1540:8-21
>
> Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
>
> Now as the comments in the source say, it works fine if you replace
> newtype with data, and I am aware that there are differences in what they
> do, though I can never quite remember the fine details. So it's quite
> possibly my fault, but an error message other than a GHC crash would be
> nicer!
New description:
I've personally not checked this against 6.6.1, but "mauke" on #haskell
says the same crash and same line number appears in the crash report.
{{{
$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 6.6
$ ghc -v --make Session.hs
Glasgow Haskell Compiler, Version 6.6, for Haskell 98, compiled by GHC
version 6.6
Using package config file: /usr/lib/ghc-6.6/package.conf
hiding package hinstaller-2007.4.21 to avoid conflict with later version
hinstaller-2007.4.24
wired-in package base mapped to base-2.0
wired-in package rts mapped to rts-1.0
wired-in package haskell98 mapped to haskell98-1.0
wired-in package template-haskell mapped to template-haskell-2.0
Hsc static flags: -static
*** Chasing dependencies:
Chasing modules from: Session.hs
Stable obj: []
Stable BCO: []
compile: input file Session.hs
Created temporary directory: /tmp/ghc4588_0
*** Checking old interface for main:Main:
[1 of 1] Compiling Main ( Session.hs, Session.o )
*** Parser:
*** Renamer/typechecker:
*** Desugar:
Result size = 379
*** Simplify:
*** Deleting temp files:
Deleting: /tmp/ghc4588_0/ghc4588_0.s
Warning: deleting non-existent /tmp/ghc4588_0/ghc4588_0.s
*** Deleting temp dirs:
Deleting: /tmp/ghc4588_0
ghc-6.6: panic! (the 'impossible' happened)
(GHC version 6.6 for x86_64-unknown-linux):
Pattern match failure in do expression at
simplCore/Simplify.lhs:1540:8-21
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
}}}
Now as the comments in the source say, it works fine if you replace
newtype with data, and I am aware that there are differences in what they
do, though I can never quite remember the fine details. So it's quite
possibly my fault, but an error message other than a GHC crash would be
nicer!
Comment:
Good one! What is happening is this. During optimisation, GHC removes
impossible alternatives from a case expression. Your program has this:
{{{
data List :: * -> * -> * where
Nil :: List a Zero
Cons :: (TyNum p) => a -> List a p -> List a (Succ p)
}}}
where `Succ` is a '''newtype'''. GHC 6.6 has a split personality about
newtypes. During typechecking it regards a newtype T and its
representation type as distinct. But during optimisation it regards them
as the same. That's WRONG here, because it makes GHC stupidly remove a
case alterantive that is not dead.
All this works fine in the HEAD, which regards a newtype and its rep type
as distinct throughout (much tidier). So I won't fix 6.6. Meanwhile
you'd be better defining your Succ type like this:
{{{
data Succ p
}}}
You aren't using it to carry data, and GHC allows you to define data types
with no constructors.
I'll add this to the test suite though!
Simon
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1323>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
-------------- next part --------------
_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs at haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
More information about the Glasgow-haskell-bugs
mailing list