#5303 closed bug (fixed)
GHC crash (panic) with -O2 and nonexistent .hi
Reported by: | mornfall | Owned by: | |
---|---|---|---|
Priority: | high | Milestone: | 7.2.1 |
Component: | Compiler | Version: | 7.0.3 |
Keywords: | Cc: | dimitris@… | |
Operating System: | Linux | Architecture: | x86 |
Type of failure: | Compile-time crash | Test Case: | simplCore/should_compile/T5303 |
Blocked By: | Blocking: | ||
Related Tickets: | Differential Revisions: |
Description (last modified by igloo)
14:13:47 | morn@ald:~/dev/darcs/prims-v3 -> ghc test.hs [1 of 1] Compiling Test ( test.hs, test.o ) 14:13:51 | morn@ald:~/dev/darcs/prims-v3 -> ghc -O2 test.hs 14:13:52 | morn@ald:~/dev/darcs/prims-v3 -> rm test.{hi,o} 14:14:03 | morn@ald:~/dev/darcs/prims-v3 -> ghc -O2 test.hs [1 of 1] Compiling Test ( test.hs, test.o ) ghc: panic! (the 'impossible' happened) (GHC version 7.0.3 for i386-unknown-linux): funResultTy <pred>main:Test.ApplyState{tc rrv} p{tv aBn} [sk] ~ hashed-storage-0.5.7:Storage.Hashed.Tree.Tree{tc r4Y} Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
I am attaching the test.hs that causes this. It needs hashed-storage and mtl from hackage to build, but otherwise it should be fairly minimal. I suppose I could cut it down further to only need mtl, but I already spent an hour tracking this down instead of getting work done. If you do need a further cutdown, let me know though, and I can try.
14:12:26 | morn@ald:~ -> ghc --version The Glorious Glasgow Haskell Compilation System, version 7.0.3
(GHC installed from Debian packages)
Attachments (1)
Change History (10)
Changed 4 years ago by mornfall
comment:1 Changed 4 years ago by mornfall
comment:2 Changed 4 years ago by simonmar
- Milestone set to 7.2.1
- Priority changed from normal to high
comment:3 Changed 4 years ago by simonmar
confirmed:
$ ghc -O2 5303.hs [1 of 1] Compiling Test ( 5303.hs, 5303.o ) ghc: panic! (the 'impossible' happened) (GHC version 7.0.3 for x86_64-unknown-linux): funResultTy <pred>main:Test.ApplyState{tc rrv} p{tv aBn} [sk] ~ hashed-storage-0.5.6:Storage.Hashed.Tree.Tree{tc r4V}
unfortunately I can't test with HEAD because hashed-storage doesn't install:
$ cabal install hashed-storage Resolving dependencies... cabal: cannot configure dataenc-0.14. It requires base >=3.0.0 && <4.4 For the dependency on base >=3.0.0 && <4.4 there are these packages: base-3.0.3.1, base-3.0.3.2, base-4.0.0.0, base-4.1.0.0, base-4.2.0.0, base-4.2.0.1, base-4.2.0.2, base-4.3.0.0 and base-4.3.1.0. However none of them are available.
comment:4 Changed 4 years ago by mornfall
Ok, I distilled the test case further (still crashing for me):
{-# LANGUAGE KindSignatures, GADTs, TypeFamilies, MultiParamTypeClasses, FlexibleContexts, ScopedTypeVariables, TypeSynonymInstances, FlexibleInstances #-} module Test( showContextSeries ) where import Control.Monad.State.Strict( StateT ) import Control.Monad.Trans ( lift ) data Tree m = Tree {} data FL (a :: * -> * -> *) x z where (:>:) :: a x y -> FL a y z -> FL a x z NilFL :: FL a x x class (Functor m, Monad m) => ApplyMonad m (state :: (* -> *) -> *) class Apply (p :: * -> * -> *) where type ApplyState p :: (* -> *) -> * apply :: ApplyMonad m (ApplyState p) => p x y -> m () class (Functor m, Monad m, ApplyMonad (ApplyMonadOver m state) state) => ApplyMonadTrans m (state :: (* -> *) -> *) where type ApplyMonadOver m state :: * -> * runApplyMonad :: (ApplyMonadOver m state) x -> state m -> m (x, state m) instance (Functor m, Monad m) => ApplyMonadTrans m Tree where type ApplyMonadOver m Tree = TreeMonad m runApplyMonad = virtualTreeMonad instance (Functor m, Monad m) => ApplyMonad (TreeMonad m) Tree -- | Internal state of the 'TreeIO' monad. Keeps track of the current Tree -- content, unsync'd changes and a current working directory (of the monad). data TreeState m = TreeState { tree :: !(Tree m) } type TreeMonad m = StateT (TreeState m) m type TreeIO = TreeMonad IO virtualTreeMonad :: (Functor m, Monad m) => TreeMonad m a -> Tree m -> m (a, Tree m) virtualTreeMonad action t = undefined applyToState :: forall p m x y. (Apply p, ApplyMonadTrans m (ApplyState p)) => p x y -> (ApplyState p) m -> m ((ApplyState p) m) applyToState _ _ = snd `fmap` runApplyMonad undefined undefined showContextSeries :: (Apply p, ApplyState p ~ Tree) => FL p x y -> TreeIO () showContextSeries (p:>:_) = (undefined >>= lift . applyToState p) >> return ()
Still needs MTL, but you could at least in theory get rid of that as well. Whether it is practical, I can't say without trying.
comment:5 Changed 4 years ago by simonpj
- Cc dimitris@… added
comment:6 Changed 4 years ago by simonpj
- Status changed from new to merge
- Test Case set to simplCore/should_compile/T303
I believe that, despite the commit message, this patch fixes the bug
commit e91c7ea8afb81f0ed184437f3eef840e5faf047c Author: Simon Peyton Jones <[email protected]> Date: Fri Jul 15 17:14:10 2011 +0100 A bit more work to to keep the right in-scope set around This change gets rid of a debug WARNING; it wasn't actually making anything go wrong, but it's best to have the correct in-scope set. compiler/typecheck/TcInstDcls.lhs | 6 ++- compiler/types/Coercion.lhs | 18 +++---- compiler/types/OptCoercion.lhs | 98 +++++++++++++++++++------------------ 3 files changed, 61 insertions(+), 61 deletions(-)
I think I just forgot what I had fixed! Anyway, it certainly works now, and I've added a test. Thanks for reporting it.
Pls merge to 7.2
Simon
comment:7 Changed 4 years ago by igloo
- Description modified (diff)
comment:8 Changed 4 years ago by igloo
- Resolution set to fixed
- Status changed from merge to closed
comment:9 Changed 4 years ago by simonmar
- Test Case changed from simplCore/should_compile/T303 to simplCore/should_compile/T5303
(sorry about the formatting, but trac won't let me edit it now... let me try again)