#4121: Refactor the plumbing of CafInfo to make it more robust
---------------------------------+------------------------------------------
Reporter: dterei | Owner:
Type: bug | Status: new
Priority: normal | Milestone: 6.14.1
Component: Compiler | Version: 6.12.2
Keywords: | Difficulty:
Os: Unknown/Multiple | Testcase:
Architecture: Unknown/Multiple | Failure: Building GHC failed
---------------------------------+------------------------------------------
Old description:
> While comping GHC Head using the devel1 flavour and ghc-6.12.2 as the
> bootstrap compiler, I get the following assertion failure:
>
> {{{
> "inplace/bin/ghc-stage1" -H64m -O -fasm -package-name base-4.3.0.0
> -hide-all-packages -i -ilibraries/base/. -ilibraries/base/dist-
> install/build -ilibraries/base/dist-install/build/autogen
> -Ilibraries/base/dist-install/build -Ilibraries/base/dist-
> install/build/autogen -Ilibraries/base/include -optP-
> DOPTIMISE_INTEGER_GCD_LCM -optP-include -optPlibraries/base/dist-
> install/build/autogen/cabal_macros.h -package ghc-prim-0.2.0.0 -package
> integer-gmp-0.2.0.0 -package rts-1.0 -package-name base -XMagicHash
> -XExistentialQuantification -XRank2Types -XScopedTypeVariables
> -XUnboxedTuples -XForeignFunctionInterface -XUnliftedFFITypes
> -XDeriveDataTypeable -XGeneralizedNewtypeDeriving -XFlexibleInstances
> -XStandaloneDeriving -XPatternGuards -XEmptyDataDecls -XNoImplicitPrelude
> -XCPP -no-user-package-conf -rtsopts -O -dcore-lint -fno-warn-deprecated-
> flags -odir libraries/base/dist-install/build -hidir libraries/base
> /dist-install/build -stubdir libraries/base/dist-install/build -hisuf hi
> -osuf o -hcsuf hc -c libraries/base/./Control/Applicative.hs -o
> libraries/base/dist-install/build/Control/Applicative.o
>
> WARNING: file compiler/simplCore/CSE.lhs line 349 a_aup
> WARNING: file compiler/simplCore/CSE.lhs line 349 a_aup
> WARNING: file compiler/stgSyn/CoreToStg.lhs line 220
> Control.Applicative.$fAlternativeSTM
> ghc-stage1: panic! (the 'impossible' happened)
> (GHC version 6.13 for i386-unknown-linux):
> ASSERT failed! file compiler/stgSyn/CoreToStg.lhs line 187
> base:Control.Applicative.$fAlternativeSTM{v rk} [gid[DFunId]]
> let {
> sat_s1oj{v} [lid]
> :: forall a{tv 12} [tv].
> ghc-prim:GHC.Prim.State#{(w) tc 32q}
> ghc-prim:GHC.Prim.RealWorld{(w) tc 31E}
> -> (# ghc-prim:GHC.Prim.State#{(w) tc 32q}
> ghc-prim:GHC.Prim.RealWorld{(w) tc 31E},
> a{tv 12} [tv] #)
> [LclId]
> sat_s1oj{v} [lid] =
> \ (@ a{tv 12} [tv])
> (eta_B1{v} [lid]
> :: ghc-prim:GHC.Prim.State#{(w) tc 32q}
> ghc-prim:GHC.Prim.RealWorld{(w) tc 31E}) ->
> ghc-prim:GHC.Prim.retry#{(w) v 93U} [gid[PrimOp]]
> @ a{tv 12} [tv] eta_B1{v} [lid] } in
> base:Control.Applicative.D:Alternative{v rrp} [gid[DataCon]]
> @ <nt>base:GHC.Conc.STM{tc r2r}
> base:Control.Applicative.$fApplicativeSTM{v r2q} [gid[DFunId]]
> (sat_s1oj{v} [lid]
> `cast` (forall a{tv aIy} [tv].
> ghc-prim:GHC.Prim.sym{(w) tc 34v}
> (base:GHC.Conc.NTCo:STM{tc r2m} a{tv aIy} [tv])
> :: (forall a{tv aIy} [tv].
> ghc-prim:GHC.Prim.State#{(w) tc 32q}
> ghc-prim:GHC.Prim.RealWorld{(w) tc 31E}
> -> (# ghc-prim:GHC.Prim.State#{(w) tc 32q}
> ghc-prim:GHC.Prim.RealWorld{(w) tc 31E},
> a{tv aIy} [tv] #))
> ~
> (forall a{tv aIy} [tv]. base:GHC.Conc.STM{tc r2r} a{tv aIy}
> [tv])))
> (base:GHC.Conc.orElse1{v re9} [gid]
> `cast` (forall a{tv aIx} [tv].
> base:GHC.Conc.STM{tc r2r} a{tv aIx} [tv]
> -> base:GHC.Conc.STM{tc r2r} a{tv aIx} [tv]
> -> ghc-prim:GHC.Prim.sym{(w) tc 34v}
> (base:GHC.Conc.NTCo:STM{tc r2m} a{tv aIx} [tv])
> :: (forall a{tv aIx} [tv].
> base:GHC.Conc.STM{tc r2r} a{tv aIx} [tv]
> -> base:GHC.Conc.STM{tc r2r} a{tv aIx} [tv]
> -> ghc-prim:GHC.Prim.State#{(w) tc 32q}
> ghc-prim:GHC.Prim.RealWorld{(w) tc 31E}
> -> (# ghc-prim:GHC.Prim.State#{(w) tc 32q}
> ghc-prim:GHC.Prim.RealWorld{(w) tc 31E},
> a{tv aIx} [tv] #))
> ~
> (forall a{tv aIx} [tv].
> base:GHC.Conc.STM{tc r2r} a{tv aIx} [tv]
> -> base:GHC.Conc.STM{tc r2r} a{tv aIx} [tv]
> -> base:GHC.Conc.STM{tc r2r} a{tv aIx} [tv])))
> (base:Control.Applicative.$fAlternativeSTM3{v r2n} [gid]
> `cast` (forall a{tv aup} [sk].
> base:GHC.Conc.STM{tc r2r} a{tv aup} [sk]
> -> ghc-prim:GHC.Prim.sym{(w) tc 34v}
> (base:GHC.Conc.NTCo:STM{tc r2m} [a{tv aup} [sk]])
> :: (forall a{tv aup} [sk].
> base:GHC.Conc.STM{tc r2r} a{tv aup} [sk]
> -> ghc-prim:GHC.Prim.State#{(w) tc 32q}
> ghc-prim:GHC.Prim.RealWorld{(w) tc 31E}
> -> (# ghc-prim:GHC.Prim.State#{(w) tc 32q}
> ghc-prim:GHC.Prim.RealWorld{(w) tc 31E},
> [a{tv aup} [sk]] #))
> ~
> (forall a{tv aup} [sk].
> base:GHC.Conc.STM{tc r2r} a{tv aup} [sk]
> -> base:GHC.Conc.STM{tc r2r} [a{tv aup} [sk]])))
> (base:Control.Applicative.$fAlternativeSTM1{v r2l} [gid]
> `cast` (forall a{tv av2} [sk].
> base:GHC.Conc.STM{tc r2r} a{tv av2} [sk]
> -> ghc-prim:GHC.Prim.sym{(w) tc 34v}
> (base:GHC.Conc.NTCo:STM{tc r2m} [a{tv av2} [sk]])
> :: (forall a{tv av2} [sk].
> base:GHC.Conc.STM{tc r2r} a{tv av2} [sk]
> -> ghc-prim:GHC.Prim.State#{(w) tc 32q}
> ghc-prim:GHC.Prim.RealWorld{(w) tc 31E}
> -> (# ghc-prim:GHC.Prim.State#{(w) tc 32q}
> ghc-prim:GHC.Prim.RealWorld{(w) tc 31E},
> [a{tv av2} [sk]] #))
> ~
> (forall a{tv av2} [sk].
> base:GHC.Conc.STM{tc r2r} a{tv av2} [sk]
> -> base:GHC.Conc.STM{tc r2r} [a{tv av2} [sk]])))
> base:Control.Applicative.$fAlternativeSTM{v rk} [gid[DFunId]] =
> [] \u srt:SRT:[] []
> let {
> sat_s1oj{v} [lid] =
> [] \r srt:SRT:[] [eta_B1{v} [lid]] retry#{v} [eta_B1{v}
> [lid]];
> } in
> base:Control.Applicative.D:Alternative{d rra}
> [base:Control.Applicative.$fApplicativeSTM{v r2q} [gid[DFunId]]
> sat_s1oj{v}
> [lid]
> base:GHC.Conc.orElse1{v re9} [gid]
> base:Control.Applicative.$fAlternativeSTM3{v r2n} [gid]
> base:Control.Applicative.$fAlternativeSTM1{v r2l} [gid]];
>
> Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
> }}}
>
> This is on the 32bit MSRC machine by the way. On my own laptop running
> Ubuntu 10.04 I don't get this (bootstrap compiler is 6.12.1 though).
New description:
While comping GHC Head using the devel1 flavour and ghc-6.12.2 as the
bootstrap compiler, I get the following assertion failure:
{{{
"inplace/bin/ghc-stage1" -H64m -O -fasm -package-name base-4.3.0.0
-hide-all-packages -i -ilibraries/base/. -ilibraries/base/dist-
install/build -ilibraries/base/dist-install/build/autogen -Ilibraries/base
/dist-install/build -Ilibraries/base/dist-install/build/autogen
-Ilibraries/base/include -optP-DOPTIMISE_INTEGER_GCD_LCM -optP-include
-optPlibraries/base/dist-install/build/autogen/cabal_macros.h -package
ghc-prim-0.2.0.0 -package integer-gmp-0.2.0.0 -package rts-1.0 -package-
name base -XMagicHash -XExistentialQuantification -XRank2Types
-XScopedTypeVariables -XUnboxedTuples -XForeignFunctionInterface
-XUnliftedFFITypes -XDeriveDataTypeable -XGeneralizedNewtypeDeriving
-XFlexibleInstances -XStandaloneDeriving -XPatternGuards -XEmptyDataDecls
-XNoImplicitPrelude -XCPP -no-user-package-conf -rtsopts -O -dcore-lint
-fno-warn-deprecated-flags -odir libraries/base/dist-install/build
-hidir libraries/base/dist-install/build -stubdir libraries/base/dist-
install/build -hisuf hi -osuf o -hcsuf hc -c
libraries/base/./Control/Applicative.hs -o libraries/base/dist-
install/build/Control/Applicative.o
WARNING: file compiler/simplCore/CSE.lhs line 349 a_aup
WARNING: file compiler/simplCore/CSE.lhs line 349 a_aup
WARNING: file compiler/stgSyn/CoreToStg.lhs line 220
Control.Applicative.$fAlternativeSTM
ghc-stage1: panic! (the 'impossible' happened)
(GHC version 6.13 for i386-unknown-linux):
ASSERT failed! file compiler/stgSyn/CoreToStg.lhs line 187
...blah...
base:Control.Applicative.$fAlternativeSTM{v rk} [gid[DFunId]] =
[] \u srt:SRT:[] []
let {
sat_s1oj{v} [lid] =
[] \r srt:SRT:[] [eta_B1{v} [lid]] retry#{v} [eta_B1{v}
[lid]];
} in
base:Control.Applicative.D:Alternative{d rra}
[base:Control.Applicative.$fApplicativeSTM{v r2q} [gid[DFunId]]
sat_s1oj{v} [lid]
base:GHC.Conc.orElse1{v re9} [gid]
base:Control.Applicative.$fAlternativeSTM3{v r2n} [gid]
base:Control.Applicative.$fAlternativeSTM1{v r2l} [gid]];
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
}}}
This is on the 32bit MSRC machine by the way. On my own laptop running
Ubuntu 10.04 I don't get this (bootstrap compiler is 6.12.1 though).
--
Comment(by simonpj):
Fixed by
{{{
Mon Jun 14 14:27:26 BST 2010 [email protected]
* Gruesome fix in CorePrep to fix embarassing Trac #4121
This is a long-lurking bug that has been flushed into
the open by other arity-related changes. There's a
long comment
Note [CafInfo and floating]
to explain.
I really hate the contortions we have to do through to keep correct
CafRef information on top-level binders. The Right Thing, I believe,
is to compute CAF and arity information later, and merge it into the
interface-file information when the latter is generated.
But for now, this hackily fixes the problem.
M ./compiler/coreSyn/CorePrep.lhs -40 +120
}}}
However we need a more general fix; `Note [CafInfo and floating]`
concludes
{{{
This is all very gruesome and horrible. It would be better to figure
out CafInfo later, after CorePrep. We'll do that in due course.
Meanwhile this horrible hack works.
}}}
So I'll re-titling the ticket.
Simon
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4121#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs