help understanding a ghc assert failure wrt coercions

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

help understanding a ghc assert failure wrt coercions

Carter Schonwald
Hey all,
I've been spending a little bit of time hacking out my own little "erase coercions"
branch, and with asserts enabled i'm seeing a very strange panic that seems to be invalid?
namely: its stating that the types have changed,

BUT the error output indicates that the  types  are the same on both sides!



ghc: panic! (the 'impossible' happened)
  (GHC version 8.11.0.20200106:
ASSERT failed!
  optCoercion changed types!
  in_co:
    Univ(representational Erased
         :: IO a_a2Pd, State# RealWorld -> (# State# RealWorld, a_a2Pd #))
  in_ty1: IO a_a2Pd
  in_ty2: State# RealWorld -> (# State# RealWorld, a_a2Pd #)
  out_co:
    Univ(representational Erased
         :: IO a_a2Pd, State# RealWorld -> (# State# RealWorld, a_a2Pd #))
  out_ty1: IO a_a2Pd
  out_ty2: State# RealWorld -> (# State# RealWorld, a_a2Pd #)
  subst:
    [TCvSubst
       In scope: InScope {wild_00 augment ++ build foldr eqString bindIO
                          returnIO otherwise assert thenIO breakpoint breakpointCond map $
                          join f_a19W x_a19X x_a1hI s_a1hZ $c==_a2rD $c/=_a2rM $cp1Ord_a2rY
                          $ccompare_a2s0 $c<_a2se $c<=_a2ss $c>_a2sy $c>=_a2sE $cmax_a2sL
                          $cmin_a2sS $cp1Monoid_a2t4 $cmappend_a2tf $cmconcat_a2tl $c>>=_a2tD
                          $c>>_a2tS $creturn_a2u3 $cpure_a2uo $c<*>_a2uA $cliftA2_a2uN
                          $c*>_a2v0 $c<*_a2vb $c>>=_a2vw $c>>_a2vJ $creturn_a2vU $cpure_a2wd
                          $c<*>_a2wn $cliftA2_a2wy $c*>_a2wL $c<*_a2wW $c>>=_a2xf $c>>_a2xq
                          $creturn_a2xB $c<*>_a2y0 $cliftA2_a2y9 $c*>_a2yj $c<*_a2yu
                          $cmappend_a2yS $cmconcat_a2yY $cmappend_a2ze $cmconcat_a2zk
                          $cp1Monoid_a2zE $cmempty_a2zG $cmappend_a2zU $cmconcat_a2A0
                          $cp1Monoid_a2Ai $cmempty_a2Ak $cmappend_a2Aw $cmconcat_a2AC
                          $cp1Monoid_a2AS $cmempty_a2AU $cmappend_a2B4 $cmconcat_a2Ba
                          $cp1Monoid_a2Bo $cmempty_a2Bq $cmappend_a2By $cmconcat_a2BE
                          $cmappend_a2BU $cmconcat_a2C0 $cp1Monoid_a2Cb $cmappend_a2Cj
                          $cmconcat_a2Cp $cmappend_a2CH $cmconcat_a2CN $c<>_a2CX
                          $csconcat_a2D8 $cstimes_a2De $c<>_a2Dt $csconcat_a2DA $c<>_a2DV
                          $csconcat_a2DZ $cstimes_a2E5 $c<>_a2Eu $csconcat_a2EI $cstimes_a2EO
                          $c<>_a2Fp $csconcat_a2FB $cstimes_a2FH $c<>_a2Gc $csconcat_a2Gm
                          $cstimes_a2Gs $c<>_a2GR $csconcat_a2GZ $cstimes_a2H5 $c<>_a2Hm
                          $csconcat_a2Hq $cstimes_a2Hu $c<>_a2HG $csconcat_a2HM $cstimes_a2HS
                          $c<>_a2I6 $csconcat_a2Id $cstimes_a2Ij $csconcat_a2IC $cstimes_a2II
                          $c>>=_a2J0 $c>>_a2JO $creturn_a2JZ $cpure_a2Ke $c<*>_a2Kl
                          $cliftA2_a2Kw $c*>_a2KJ $c<*_a2KU $cfmap_a2L7 $c<$_a2Lj
                          $cmzero_a2LF $cmplus_a2LO $cmzero_a2M7 $cmplus_a2Mg $cmzero_a2Mz
                          $cmplus_a2MI $csome_a2Na $cmany_a2Nj $csome_a2NK $cmany_a2NT
                          $c<|>_a2Oe $csome_a2Oj $cmany_a2Os $c>>_a2OP $creturn_a2P0
                          $cfmap_a2Pb $c<$_a2Ps a_a2Pu b_a2Pv $c>>=_a2PJ $creturn_a2Q2
                          $c>>=_a2Qh $creturn_a2Qz $c>>=_a2QP $c>>_a2QV $creturn_a2R6
                          $c<*>_a2Rr $cliftA2_a2RC $c<*_a2RX $cpure_a2Se $c<*>_a2Sj
                          $cliftA2_a2Sr $c*>_a2SA $c<*_a2SI $c<*>_a2T5 $cliftA2_a2Th
                          $c*>_a2Tq $c<*_a2Tx $c<*>_a2TW $cliftA2_a2U2 $c*>_a2U9 $c<*_a2Uk
                          $c<$_a2UF $cfmap_a2US $c<$_a2V0 $cfmap_a2Ve $c<$_a2Vk $c<$_a2VH
                          $cfmap_a2VX $c<$_a2W3 $cfmap_a2Wi $c<$_a2Wo $krep_a37a $krep_a37b
                          $krep_a37c $krep_a37d $krep_a37e $krep_a37f $krep_a37g $krep_a37h
                          $krep_a37i $krep_a37j $krep_a37k $krep_a37l $krep_a37m $krep_a37n
                          $krep_a37o $krep_a37p $krep_a37q $krep_a37r $krep_a37s $sap_d3dm
                          $sap_d3dn $sliftM5_d3ds $sliftM5_d3dt $sliftM4_d3dy $sliftM4_d3dz
                          $sliftM3_d3dE $sliftM3_d3dF $sliftM2_d3dK $sliftM2_d3dL
                          $sliftM_d3dQ $sliftM_d3dR $swhen_d3e3 $swhen_d3e4 $s=<<_d3e9
                          $sliftA3_d3eh $sliftA3_d3ei $sliftA_d3em $sliftA_d3en $tcMonoid
                          $tcSemigroup $trModule <**> liftA liftA3 =<< when sequence mapM
                          liftM liftM2 liftM3 liftM4 liftM5 ap mapFB unsafeChr ord minInt
                          maxInt id const . flip $! until asTypeOf failIO unIO getTag quotInt
                          remInt divInt modInt quotRemInt divModInt divModInt# shiftL#
                          shiftRL# iShiftL# iShiftRA# iShiftRL# $tcFunctor $dm<$ $fFunctor[]
                          $fFunctorMaybe $fFunctor(,) $fFunctor-> $fFunctor(,,,)
                          $fFunctor(,,) $tcApplicative $dm<*> $dmliftA2 $dm*> $dm<*
                          $fApplicativeIO $fApplicative[] $fApplicativeMaybe $fApplicative->
                          $tcMonad $dm>> $dmreturn $fMonadIO $fFunctorIO $fMonad[]
                          $fMonadMaybe $fMonad-> $tcAlternative $dmsome $dmmany
                          $fAlternativeIO $fAlternative[] $fAlternativeMaybe $tcMonadPlus
                          $dmmzero $dmmplus $fMonadPlusIO $fMonadPlus[] $fMonadPlusMaybe
                          $tc':| $tcNonEmpty $fMonadNonEmpty $fApplicativeNonEmpty
                          $fFunctorNonEmpty $dmsconcat $dmstimes $fSemigroupIO
                          $fSemigroupMaybe $fSemigroupOrdering $fSemigroup(,,,,)
                          $fSemigroup(,,,) $fSemigroup(,,) $fSemigroup(,) $fSemigroup()
                          $fSemigroup-> $fSemigroupNonEmpty $fSemigroup[] $dmmappend
                          $dmmconcat $tc'C:Monoid $fMonoidIO $fMonad(,,,) $fApplicative(,,,)
                          $fMonad(,,) $fApplicative(,,) $fMonad(,) $fApplicative(,)
                          $fMonoidMaybe $fMonoidOrdering $fMonoid(,,,,) $fMonoid(,,,)
                          $fMonoid(,,) $fMonoid(,) $fMonoid() $fMonoid-> $fMonoid[] $tc'O
                          $tcOpaque $fEqNonEmpty $fOrdNonEmpty returnIO_s3A8 failIO_s3A9
                          $cempty_s3Ab unIO_s3Ac thenIO_s3Ah bindIO_s3Am $trModule_s3AL
                          $trModule_s3AM $trModule_s3AN $trModule_s3AO $krep_s3AP
                          $tcFunctor_s3AQ $tcFunctor_s3AR $tcApplicative_s3AS
                          $tcApplicative_s3AT $tcMonad_s3AU $tcMonad_s3AV $tcAlternative_s3AW
                          $tcAlternative_s3AX $tcMonadPlus_s3AY $tcMonadPlus_s3AZ
                          $tcNonEmpty_s3B0 $tcNonEmpty_s3B1 $krep_s3B2 $tc':|_s3B3
                          $tc':|_s3B4 $tcSemigroup_s3B5 $tcSemigroup_s3B6 $krep_s3B7
                          $tcMonoid_s3B8 $tcMonoid_s3B9 $krep_s3Ba $tc'C:Monoid_s3Bb
                          $tc'C:Monoid_s3Bc $tcOpaque_s3Bd $tcOpaque_s3Be $tc'O_s3Bf
                          $tc'O_s3Bg $cliftA2_s3BL $cfmap_s3BP $c<*>_s3BT $sap_s3BW
                          $sliftM2_s3BZ $sliftM5_s3Cc $sliftM4_s3Ch $sliftM3_s3Cl
                          $sliftM_s3Co f_s3FS}
       Type env: [a2Pd :-> b_a2Pv, a2Pe :-> a_a2Pu]
       Co env: []]
  Call stack:
      CallStack (from HasCallStack):
        callStackDoc, called at compiler/utils/Outputable.hs:1173:37 in ghc:Outputable
        pprPanic, called at compiler/utils/Outputable.hs:1243:5 in ghc:Outputable
        assertPprPanic, called at compiler/types/OptCoercion.hs:122:41 in ghc:OptCoercion

_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
Reply | Threaded
Open this post in threaded view
|

Re: help understanding a ghc assert failure wrt coercions

Ben Gamari-2
On January 5, 2020 10:11:30 PM EST, Carter Schonwald <[hidden email]> wrote:

>Hey all,
>I've been spending a little bit of time hacking out my own little
>"erase
>coercions"
>branch, and with asserts enabled i'm seeing a very strange panic that
>seems
>to be invalid?
>namely: its stating that the types have changed,
>
>BUT the error output indicates that the  types  are the same on both
>sides!
>
>
>
>ghc: panic! (the 'impossible' happened)
>  (GHC version 8.11.0.20200106:
>ASSERT failed!
>  optCoercion changed types!
>  in_co:
>    Univ(representational Erased
>      :: IO a_a2Pd, State# RealWorld -> (# State# RealWorld, a_a2Pd #))
>  in_ty1: IO a_a2Pd
>  in_ty2: State# RealWorld -> (# State# RealWorld, a_a2Pd #)
>  out_co:
>    Univ(representational Erased
>      :: IO a_a2Pd, State# RealWorld -> (# State# RealWorld, a_a2Pd #))
>  out_ty1: IO a_a2Pd
>  out_ty2: State# RealWorld -> (# State# RealWorld, a_a2Pd #)
>  subst:
>    [TCvSubst
>      In scope: InScope {wild_00 augment ++ build foldr eqString bindIO
>                          returnIO otherwise assert thenIO breakpoint
>breakpointCond map $
>                          join f_a19W x_a19X x_a1hI s_a1hZ $c==_a2rD
>$c/=_a2rM $cp1Ord_a2rY
>                          $ccompare_a2s0 $c<_a2se $c<=_a2ss $c>_a2sy
>$c>=_a2sE $cmax_a2sL
>                          $cmin_a2sS $cp1Monoid_a2t4 $cmappend_a2tf
>$cmconcat_a2tl $c>>=_a2tD
>                         $c>>_a2tS $creturn_a2u3 $cpure_a2uo $c<*>_a2uA
>$cliftA2_a2uN
>                          $c*>_a2v0 $c<*_a2vb $c>>=_a2vw $c>>_a2vJ
>$creturn_a2vU $cpure_a2wd
>                          $c<*>_a2wn $cliftA2_a2wy $c*>_a2wL $c<*_a2wW
>$c>>=_a2xf $c>>_a2xq
>                       $creturn_a2xB $c<*>_a2y0 $cliftA2_a2y9 $c*>_a2yj
>$c<*_a2yu
>                          $cmappend_a2yS $cmconcat_a2yY $cmappend_a2ze
>$cmconcat_a2zk
>                          $cp1Monoid_a2zE $cmempty_a2zG $cmappend_a2zU
>$cmconcat_a2A0
>                          $cp1Monoid_a2Ai $cmempty_a2Ak $cmappend_a2Aw
>$cmconcat_a2AC
>                          $cp1Monoid_a2AS $cmempty_a2AU $cmappend_a2B4
>$cmconcat_a2Ba
>                          $cp1Monoid_a2Bo $cmempty_a2Bq $cmappend_a2By
>$cmconcat_a2BE
>                          $cmappend_a2BU $cmconcat_a2C0 $cp1Monoid_a2Cb
>$cmappend_a2Cj
>                          $cmconcat_a2Cp $cmappend_a2CH $cmconcat_a2CN
>$c<>_a2CX
>                          $csconcat_a2D8 $cstimes_a2De $c<>_a2Dt
>$csconcat_a2DA $c<>_a2DV
>                          $csconcat_a2DZ $cstimes_a2E5 $c<>_a2Eu
>$csconcat_a2EI $cstimes_a2EO
>                       $c<>_a2Fp $csconcat_a2FB $cstimes_a2FH $c<>_a2Gc
>$csconcat_a2Gm
>                          $cstimes_a2Gs $c<>_a2GR $csconcat_a2GZ
>$cstimes_a2H5 $c<>_a2Hm
>                          $csconcat_a2Hq $cstimes_a2Hu $c<>_a2HG
>$csconcat_a2HM $cstimes_a2HS
>                          $c<>_a2I6 $csconcat_a2Id $cstimes_a2Ij
>$csconcat_a2IC $cstimes_a2II
>                         $c>>=_a2J0 $c>>_a2JO $creturn_a2JZ $cpure_a2Ke
>$c<*>_a2Kl
>                          $cliftA2_a2Kw $c*>_a2KJ $c<*_a2KU $cfmap_a2L7
>$c<$_a2Lj
>                          $cmzero_a2LF $cmplus_a2LO $cmzero_a2M7
>$cmplus_a2Mg $cmzero_a2Mz
>                       $cmplus_a2MI $csome_a2Na $cmany_a2Nj $csome_a2NK
>$cmany_a2NT
>                          $c<|>_a2Oe $csome_a2Oj $cmany_a2Os $c>>_a2OP
>$creturn_a2P0
>                         $cfmap_a2Pb $c<$_a2Ps a_a2Pu b_a2Pv $c>>=_a2PJ
>$creturn_a2Q2
>                          $c>>=_a2Qh $creturn_a2Qz $c>>=_a2QP $c>>_a2QV
>$creturn_a2R6
>                         $c<*>_a2Rr $cliftA2_a2RC $c<*_a2RX $cpure_a2Se
>$c<*>_a2Sj
>                          $cliftA2_a2Sr $c*>_a2SA $c<*_a2SI $c<*>_a2T5
>$cliftA2_a2Th
>                          $c*>_a2Tq $c<*_a2Tx $c<*>_a2TW $cliftA2_a2U2
>$c*>_a2U9 $c<*_a2Uk
>                          $c<$_a2UF $cfmap_a2US $c<$_a2V0 $cfmap_a2Ve
>$c<$_a2Vk $c<$_a2VH
>                          $cfmap_a2VX $c<$_a2W3 $cfmap_a2Wi $c<$_a2Wo
>$krep_a37a $krep_a37b
>                          $krep_a37c $krep_a37d $krep_a37e $krep_a37f
>$krep_a37g $krep_a37h
>                          $krep_a37i $krep_a37j $krep_a37k $krep_a37l
>$krep_a37m $krep_a37n
>                          $krep_a37o $krep_a37p $krep_a37q $krep_a37r
>$krep_a37s $sap_d3dm
>                          $sap_d3dn $sliftM5_d3ds $sliftM5_d3dt
>$sliftM4_d3dy $sliftM4_d3dz
>                          $sliftM3_d3dE $sliftM3_d3dF $sliftM2_d3dK
>$sliftM2_d3dL
>                      $sliftM_d3dQ $sliftM_d3dR $swhen_d3e3 $swhen_d3e4
>$s=<<_d3e9
>                          $sliftA3_d3eh $sliftA3_d3ei $sliftA_d3em
>$sliftA_d3en $tcMonoid
>                      $tcSemigroup $trModule <**> liftA liftA3 =<< when
>sequence mapM
>                          liftM liftM2 liftM3 liftM4 liftM5 ap mapFB
>unsafeChr ord minInt
>                        maxInt id const . flip $! until asTypeOf failIO
>unIO getTag quotInt
>                          remInt divInt modInt quotRemInt divModInt
>divModInt# shiftL#
>                       shiftRL# iShiftL# iShiftRA# iShiftRL# $tcFunctor
>$dm<$ $fFunctor[]
>                          $fFunctorMaybe $fFunctor(,) $fFunctor->
>$fFunctor(,,,)
>                          $fFunctor(,,) $tcApplicative $dm<*> $dmliftA2
>$dm*> $dm<*
>                          $fApplicativeIO $fApplicative[]
>$fApplicativeMaybe $fApplicative->
>                         $tcMonad $dm>> $dmreturn $fMonadIO $fFunctorIO
>$fMonad[]
>                          $fMonadMaybe $fMonad-> $tcAlternative $dmsome
>$dmmany
>                          $fAlternativeIO $fAlternative[]
>$fAlternativeMaybe $tcMonadPlus
>                          $dmmzero $dmmplus $fMonadPlusIO $fMonadPlus[]
>$fMonadPlusMaybe
>                          $tc':| $tcNonEmpty $fMonadNonEmpty
>$fApplicativeNonEmpty
>                          $fFunctorNonEmpty $dmsconcat $dmstimes
>$fSemigroupIO
>                          $fSemigroupMaybe $fSemigroupOrdering
>$fSemigroup(,,,,)
>                        $fSemigroup(,,,) $fSemigroup(,,) $fSemigroup(,)
>$fSemigroup()
>                        $fSemigroup-> $fSemigroupNonEmpty $fSemigroup[]
>$dmmappend
>                        $dmmconcat $tc'C:Monoid $fMonoidIO $fMonad(,,,)
>$fApplicative(,,,)
>                          $fMonad(,,) $fApplicative(,,) $fMonad(,)
>$fApplicative(,)
>                          $fMonoidMaybe $fMonoidOrdering $fMonoid(,,,,)
>$fMonoid(,,,)
>                         $fMonoid(,,) $fMonoid(,) $fMonoid() $fMonoid->
>$fMonoid[] $tc'O
>                          $tcOpaque $fEqNonEmpty $fOrdNonEmpty
>returnIO_s3A8 failIO_s3A9
>                         $cempty_s3Ab unIO_s3Ac thenIO_s3Ah bindIO_s3Am
>$trModule_s3AL
>                          $trModule_s3AM $trModule_s3AN $trModule_s3AO
>$krep_s3AP
>                          $tcFunctor_s3AQ $tcFunctor_s3AR
>$tcApplicative_s3AS
>                        $tcApplicative_s3AT $tcMonad_s3AU $tcMonad_s3AV
>$tcAlternative_s3AW
>                          $tcAlternative_s3AX $tcMonadPlus_s3AY
>$tcMonadPlus_s3AZ
>                          $tcNonEmpty_s3B0 $tcNonEmpty_s3B1 $krep_s3B2
>$tc':|_s3B3
>                        $tc':|_s3B4 $tcSemigroup_s3B5 $tcSemigroup_s3B6
>$krep_s3B7
>                          $tcMonoid_s3B8 $tcMonoid_s3B9 $krep_s3Ba
>$tc'C:Monoid_s3Bb
>                        $tc'C:Monoid_s3Bc $tcOpaque_s3Bd $tcOpaque_s3Be
>$tc'O_s3Bf
>                        $tc'O_s3Bg $cliftA2_s3BL $cfmap_s3BP $c<*>_s3BT
>$sap_s3BW
>                          $sliftM2_s3BZ $sliftM5_s3Cc $sliftM4_s3Ch
>$sliftM3_s3Cl
>                          $sliftM_s3Co f_s3FS}
>       Type env: [a2Pd :-> b_a2Pv, a2Pe :-> a_a2Pu]
>       Co env: []]
>  Call stack:
>      CallStack (from HasCallStack):
>        callStackDoc, called at compiler/utils/Outputable.hs:1173:37 in
>ghc:Outputable
>        pprPanic, called at compiler/utils/Outputable.hs:1243:5 in
>ghc:Outputable
>      assertPprPanic, called at compiler/types/OptCoercion.hs:122:41 in
>ghc:OptCoercion

Try adding -dppr-debug to your command line. This may reveal the difference.

Cheers,

- Ben
_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
Reply | Threaded
Open this post in threaded view
|

Re: help understanding a ghc assert failure wrt coercions

Richard Eisenberg-5


On Jan 6, 2020, at 4:44 AM, Ben Gamari <[hidden email]> wrote:
Try adding -dppr-debug to your command line. This may reveal the difference. 

Also, I recommend `-fprint-explicit-kinds -fprint-explicit-coercions -fprint-typechecker-elaboration -fprint-explicit-runtime-reps -fprint-explicit-foralls` just for extra confidence.

Richard


Cheers, 

- Ben 
_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs


_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs