Ticket #4203 (closed bug: fixed)

Opened 3 years ago

Last modified 3 years ago

ghc-6.12.3 fails to compile xmonad-0.9.1 tests

Reported by: slyfox Owned by: simonpj
Priority: high Milestone: 7.0.1
Component: Compiler Version: 6.12.3
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Compile-time crash Difficulty:
Test Case: simplCore/shouldCompile/T4203 Blocked By:
Blocking: Related Tickets:

Description

Long story:

$ cabal unpack xmonad-0.9.1
$ cd xmonad-0.9.1
$ sed -i -e 's/Werror/Wall/g' xmonad.cabal # *shrug*
$ cabal configure -ftesting
$ cabal build

got:

[ 8 of 11] Compiling Properties       ( tests/Properties.hs, dist/build/xmonad/xmonad-tmp/Properties.o )
ghc: panic! (the 'impossible' happened)
  (GHC version 6.12.3 for x86_64-unknown-linux):
        bind_args
    base:GHC.Real.D:Integral{d r3W}
    [tpl_B2{v} [lid], tpl_B3{v} [lid], tpl_B4{v} [lid],
     tpl_B5{v} [lid], tpl_B6{v} [lid], tpl_B7{v} [lid], tpl_B8{v} [lid],
     tpl_B9{v} [lid], tpl_Ba{v} [lid]]
    [TYPE ghc-prim:GHC.Types.Int{(w) tc 3J},
     base:GHC.Real.$fOrdRatio_$dEq{v reC} [gid]
     `cast` (ghc-prim:GHC.Prim.trans{(w) tc 34y}
               <pred>base:GHC.Classes.Eq{tc 23}
                       (ghc-prim:GHC.Prim.sym{(w) tc 34v}
                          (main:Properties.NTCo:NonNegative{tc r36K}
                             (base:GHC.Real.Ratio{tc 31y}
                                integer-gmp:GHC.Integer.Type.Integer{tc 314})))
               <pred>base:GHC.Classes.Eq{tc 23}
                       (main:Properties.NTCo:NonNegative{tc r36K}
                          ghc-prim:GHC.Types.Int{(w) tc 3J})
             :: <pred><pred>base:GHC.Classes.Eq{tc 23}
                              (base:GHC.Real.Ratio{tc 31y}
                                 integer-gmp:GHC.Integer.Type.Integer{tc 314})
                        ~
                      <pred>base:GHC.Classes.Eq{tc 23}
                              ghc-prim:GHC.Types.Int{(w) tc 3J}),
...

(whole error message is in whole-failure.txt)

As there is many packages involved i have tried to shrink error to package w/o external depends (instance_test.tar.gz). But it has simpler error, so it can be another bug:

$ tests:./make_bad.sh 
[1 of 3] Compiling Test_QuickCheck  ( Test_QuickCheck.hs, Test_QuickCheck.o )
[2 of 3] Compiling XMonad_StackSet  ( XMonad_StackSet.hs, XMonad_StackSet.o )
[3 of 3] Compiling Properties       ( Properties.hs, Properties.o )
ghc: panic! (the 'impossible' happened)
  (GHC version 6.12.3 for x86_64-unknown-linux):
        expectJust chooseExternalIds: wild_B1

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

ghc-6.10.4 compiles even this stripped thing.

Attachments

whole-failure.txt Download (12.4 KB) - added by slyfox 3 years ago.
original failure
instance_test.tar.gz Download (4.6 KB) - added by slyfox 3 years ago.
test w/o external deps

Change History

Changed 3 years ago by slyfox

original failure

Changed 3 years ago by slyfox

test w/o external deps

Changed 3 years ago by slyfox

ghc-6.13.20100716 compiles xmonad correctly and all 'xmonad --run-tests' passes all tests.

Is it ghc-6.12-branch only resgression or it was fixed in -HEAD recently? I'd like to grab the patch from -HEAD.

Changed 3 years ago by simonpj

Trying to install xmonad's dependencies (on Windows) fails thus

cabal install X11
Resolving dependencies...
Configuring X11-1.5.0.0...
configure: WARNING: unrecognized options: --with-compiler
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/tmp/X11-1.5.0.03600/X11-1.5.0.0':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details.
cabal.exe: Error: some packages failed to install:
X11-1.5.0.0 failed during the configure step. The exception was:
ExitFailure 1
bash-3.1$ cabal --version
cabal-install version 0.8.2
using version 1.8.0.2 of the Cabal library 
bash-3.1$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 6.12.3
bash-3.1$ 

So that makes it hard to reproduce your failure.

I'll try your stripped down thing next

Simon

Changed 3 years ago by igloo

Smaller example:

{-# LANGUAGE GeneralizedNewtypeDeriving #-}

module Properties where

newtype NonNegative a = NonNegative a
 deriving (Eq, Num, Show)

instance Num a => Arbitrary (NonNegative a) where
  arbitrary = return 0

newtype EmptyStackSet = EmptyStackSet StackSet

instance Arbitrary EmptyStackSet where
    arbitrary = do
        _ <- arbitrary :: Gen (NonNegative Int)
        return $ EmptyStackSet StackSet

newtype Gen a = Gen a

instance Monad Gen where
  return a    = Gen a
  Gen m >>= k = Gen (let Gen m' = k m in m')

class Arbitrary a where
  arbitrary   :: Gen a
  coarbitrary :: a

data StackSet = StackSet
ghc --make -O1 Properties.hs -Wall
[1 of 1] Compiling Properties       ( Properties.hs, Properties.o )
ghc: panic! (the 'impossible' happened)
  (GHC version 6.12.3 for x86_64-unknown-linux):
        expectJust chooseExternalIds: wild_B1

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

Changed 3 years ago by simonpj

Excellent job Ian. I konw exactly what is happening now. It's a bug in the specialiser. I have a nice fix in the works, but cannot do before going on holiday.

Simon

Changed 3 years ago by simonpj

PS A workaround is to compile without optimisation

Simon

Changed 3 years ago by igloo

  • owner set to simonpj
  • priority changed from normal to high
  • milestone set to 6.14.1

Changed 3 years ago by simonpj

  • status changed from new to closed
  • testcase changed from yet to simplCore/shouldCompile/T4203
  • resolution set to fixed

Fixed by

Thu Aug 12 14:11:33 BST 2010  simonpj@microsoft.com
  * Improve the Specialiser, fixing Trac #4203
  
  Simply fixing #4203 is a tiny fix: in case alterantives we should
  do dumpUDs *including* the case binder.  
  
  But I realised that we can do better and wasted far too much time
  implementing the idea.  It's described in
      Note [Floating dictionaries out of cases]

If we want to fix 6.12 as well there's a much simpler fix, but I don't think we plan another 6.12 release, so I have not done that. Meanwhile I'll close it.

Simon

Note: See TracTickets for help on using tickets.