impossible in ghc 6.2

Simon Peyton-Jones simonpj at microsoft.com
Thu Jan 8 06:57:29 EST 2004


Aha.  Got it.  

Consider 
        case f x of 
	  (# a,b #) -> if a>0 
		       then f x -- CSE opportunity
		       else (# b,a #)

 GHC 6.2's CSE pass wrongly optimised this to:

	case f x of t 
	  (# a,b #) -> if a>0 then
			  t	-- WRONG
			else (# b,a #)

(Wrong because we aren't allowed to mention a case binder for
an unboxed-tuple case.)


This bug has been there for ages.   I've committed a fix, and a small
test case to make sure it doesn't recur.

Meanwhile, refrain from -O when compiling module AbstractSyntax

Thanks for a great report.

Simon

| -----Original Message-----
| From: Isaac Jones [mailto:isaac.jones at aetion.com]
| Sent: 07 January 2004 19:37
| To: Simon Peyton-Jones
| Cc: glasgow-haskell-bugs at haskell.org
| Subject: RE: impossible in ghc 6.2
| 
| On Wed, 2004-01-07 at 11:59, Simon Peyton-Jones wrote:
| > Very mysterious.  I've never seen one of these without -dcore-lint
| > bleating first.
| 
| I added -dcore-lint again and don't see anything, but I include all
the
| output below...
| 
| > Suggestions:
| > 1. Don't use --make, so you can be certain which module is involved.
| > 2.  On the module that breaks, add -verbose-core2-core -dppr-debug
| > -ddump-stg
| > 	and send us the output.
| 
| It's pretty big, so I stuck it on a web page.  stdOut is probably what
| you're looking for.
| 
| http://www.syntaxpolice.org/tmp/stdErr
| http://www.syntaxpolice.org/tmp/stdOut
| 
| peace,
| 
| isaac



More information about the Glasgow-haskell-bugs mailing list