id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	os	architecture	failure	difficulty	testcase	blockedby	blocking	related
1402	panic in GHC when building QuickCheck with optimization	guest		"When building QuickCheck, I get:

{{{
cdsmith@devtools:~/tmp/QuickCheck$ runhaskell Setup build
Preprocessing library QuickCheck-2.0...
Building QuickCheck-2.0...
Glasgow Haskell Compiler, Version 6.7.20070529, for Haskell 98, compiled by GHC                                                                                                                            version 6.7.20070529
Using package config file: /usr/local/lib/ghc-6.7.20070529/package.conf
wired-in package base mapped to base-2.1
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-0.1
Hsc static flags: -static
*** Chasing dependencies:
Chasing modules from: Test.QuickCheck,Test.QuickCheck.Arbitrary,Test.QuickCheck.                                                                                                                           Function,Test.QuickCheck.Gen,Test.QuickCheck.Monadic,Test.QuickCheck.Property,Te                                                                                                                           st.QuickCheck.Test,Test.QuickCheck.Exception,Test.QuickCheck.Text
Stable obj: []
Stable BCO: []
Ready for upsweep
  [NONREC
      ModSummary {
         ms_hs_date = Fri Jun  1 10:28:15 MDT 2007
         ms_mod = QuickCheck-2.0:Test.QuickCheck.Gen,
         ms_imps = [Control.Monad.Reader, Control.Monad, System.Random]
         ms_srcimps = []
      },
   NONREC
      ModSummary {
         ms_hs_date = Fri Jun  1 10:11:40 MDT 2007
         ms_mod = QuickCheck-2.0:Test.QuickCheck.Arbitrary,
         ms_imps = [Control.Monad, Data.List, System.Random, Data.Ratio,
                    Data.Char, Test.QuickCheck.Gen]
         ms_srcimps = []
      },
   NONREC
      ModSummary {
         ms_hs_date = Fri Jun  1 10:11:39 MDT 2007
         ms_mod = QuickCheck-2.0:Test.QuickCheck.Exception,
         ms_imps = [Control.Exception]
         ms_srcimps = []
      },
   NONREC
      ModSummary {
         ms_hs_date = Fri Jun  1 10:11:39 MDT 2007
         ms_mod = QuickCheck-2.0:Test.QuickCheck.Text,
         ms_imps = [Data.IORef, System.IO]
         ms_srcimps = []
      },
   NONREC
      ModSummary {
         ms_hs_date = Fri Jun  1 10:11:40 MDT 2007
         ms_mod = QuickCheck-2.0:Test.QuickCheck.Property,
         ms_imps = [System.IO, Data.IORef, Control.Concurrent,
                    Test.QuickCheck.Exception, Test.QuickCheck.Text,
                    Test.QuickCheck.Arbitrary, Test.QuickCheck.Gen]
         ms_srcimps = []
      },
   NONREC
      ModSummary {
         ms_hs_date = Fri Jun  1 10:11:40 MDT 2007
         ms_mod = QuickCheck-2.0:Test.QuickCheck.Test,
         ms_imps = [Data.List, Data.Char, System.Random,
                    Test.QuickCheck.Exception, Test.QuickCheck.Text,
                    Test.QuickCheck.Property, Test.QuickCheck.Gen]
         ms_srcimps = []
      },
   NONREC
      ModSummary {
         ms_hs_date = Fri Jun  1 10:11:40 MDT 2007
         ms_mod = QuickCheck-2.0:Test.QuickCheck.Monadic,
         ms_imps = [System.IO.Unsafe, Control.Monad.ST, Control.Monad,
                    Test.QuickCheck.Arbitrary, Test.QuickCheck.Property,
                    Test.QuickCheck.Gen]
         ms_srcimps = []
      },
   NONREC
      ModSummary {
         ms_hs_date = Fri Jun  1 10:11:40 MDT 2007
         ms_mod = QuickCheck-2.0:Test.QuickCheck.Function,
         ms_imps = [System.IO.Unsafe, Data.List, Data.IORef,
                    Test.QuickCheck.Property, Test.QuickCheck.Arbitrary,
                    Test.QuickCheck.Gen]
         ms_srcimps = []
      },
   NONREC
      ModSummary {
         ms_hs_date = Fri Jun  1 10:11:40 MDT 2007
         ms_mod = QuickCheck-2.0:Test.QuickCheck,
         ms_imps = [Test.QuickCheck.Test, Test.QuickCheck.Property,
                    Test.QuickCheck.Arbitrary, Test.QuickCheck.Gen]
         ms_srcimps = []
      }]
compile: input file Test/QuickCheck/Gen.hs
Created temporary directory: /tmp/ghc2049_0
*** Checking old interface for QuickCheck-2.0:Test.QuickCheck.Gen:
[1 of 9] Compiling Test.QuickCheck.Gen ( Test/QuickCheck/Gen.hs, dist/build/Test                                                                                                                           /QuickCheck/Gen.o )
*** Parser:
*** Renamer/typechecker:
*** Desugar:
    Result size = 1180
*** Simplify:
    Result size = 803
    Result size = 789
    Result size = 789
*** Specialise:
*** Deleting temp files:
Deleting: /tmp/ghc2049_0/ghc2049_0.s
Warning: deleting non-existent /tmp/ghc2049_0/ghc2049_0.s
*** Deleting temp dirs:
Deleting: /tmp/ghc2049_0
ghc-6.7.20070529: panic! (the 'impossible' happened)
  (GHC version 6.7.20070529 for i386-unknown-linux):
        my_zipEqual
    []
    [random-1.0:System.Random.$f6{v r2X} [gid]]
    QuickCheck-2.0:Test.QuickCheck.Gen.choose{v r6H} [lid] [Just base:GHC.Base.I                                                                                                                           nt{(w) tc 3J}]
    \ (@ a{tv asq} [sk] :: base:GHC.Prim.*{(w) tc 34d}) ->
      (a_sIo{v} [lid] @ a{tv asq} [sk])
      `cast` (<pred>random-1.0:System.Random.Random{tc r33}
                      a{tv asq} [sk]
              -> (a{tv asq} [sk], a{tv asq} [sk])
              -> base:GHC.Prim.sym{(w) tc 34v}
                   ((QuickCheck-2.0:Test.QuickCheck.Gen.:CoGen{tc rfI})
                      a{tv asq} [sk])
              :: <pred>(random-1.0:System.Random.Random{tc r33}
                          a{tv asq} [sk]) =>
                       (a{tv asq} [sk], a{tv asq} [sk])
                       -> random-1.0:System.Random.StdGen{tc r35}
                       -> base:GHC.Base.Int{(w) tc 3J}
                       -> a{tv asq} [sk]
                         ~
                       (random-1.0:System.Random.Random{tc r33} a{tv asq} [sk])                                                                                                                            =>
                       (a{tv asq} [sk], a{tv asq} [sk])
                       -> <nt>QuickCheck-2.0:Test.QuickCheck.Gen.Gen{tc r76}
                            a{tv asq} [sk])

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

}}}

If I build with -Onot, the error does not occur.

{{{
cdsmith@devtools:~/tmp/QuickCheck$ uname -a
Linux devtools 2.4.27-2-k7 #1 Tue Aug 16 17:30:14 JST 2005 i686 GNU/Linux
}}}

The error occurs in:

{{{
-- | Generates a random element in the given inclusive range.
choose :: Random a => (a,a) -> Gen a
choose rng = MkGen (\r _ -> let (x,_) = randomR rng r in x)
}}}

The GHC version is one that I pulled from darcs head on the 29th of May.  It does have one local modification, but in an unrelated part of the compiler (the GHCi banner patch I sent to the cvs-ghc list on 6/1/2007)"	bug	closed	normal		Compiler	6.7	fixed		cdsmith@…	Linux	x86		Unknown	spec003			
