[GHC] #8382: ghc unhappy with program who want to program in C in haskell...
#8382: ghc unhappy with program who want to program in C in haskell... ------------------------------------+------------------------------------- Reporter: wagle | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Keywords: | Operating System: Unknown/Multiple Architecture: Unknown/Multiple | Type of failure: None/Unknown Difficulty: Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | ------------------------------------+------------------------------------- [1 of 1] Compiling Main ( test1.hs, test1.o ) ghc: panic! (the 'impossible' happened) (GHC version 7.6.3 for x86_64-apple-darwin): cgLookupPanic (probably invalid Core; try -dcore-lint) $dVector{v aFL} [lid] static binds for: local binds for: Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8382> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#8382: ghc unhappy with program who want to program in C in haskell... -------------------------------------+------------------------------------ Reporter: wagle | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------ Comment (by wagle): -dcore-lint gives: tuple:p3 wagle$ ghc -dcore-lint test1.hs [1 of 1] Compiling Main ( test1.hs, test1.o ) *** Core Lint errors : in result of Desugar (after optimization) *** <no location info>: Warning: In the expression: GHC.Show.$fShow[] @ (Data.Vector.Mutable.MVector GHC.Prim.RealWorld (GHC.Prim.Any *)) $dShow_aLp $dShow_aLp :: GHC.Show.Show (Data.Vector.Mutable.MVector GHC.Prim.RealWorld a_t1z) [LclId] is out of scope <no location info>: Warning: In the expression: GHC.Show.$fShow[] @ (Data.Vector.Mutable.MVector GHC.Prim.RealWorld (GHC.Prim.Any *)) $dShow_aLp Argument value doesn't match argument type: Fun type: GHC.Show.Show (Data.Vector.Mutable.MVector GHC.Prim.RealWorld (GHC.Prim.Any *)) => GHC.Show.Show [Data.Vector.Mutable.MVector GHC.Prim.RealWorld (GHC.Prim.Any *)] Arg type: GHC.Show.Show (Data.Vector.Mutable.MVector GHC.Prim.RealWorld a_t1z) Arg: $dShow_aLp *** Offending Program *** Rec { Main.updateMatrix :: forall (m_azy :: * -> *) a_azz. Control.Monad.Primitive.PrimMonad m_azy => Data.Vector.Mutable.MVector (Control.Monad.Primitive.PrimState m_azy) (Data.Vector.Mutable.MVector (Control.Monad.Primitive.PrimState m_azy) a_azz) -> (GHC.Types.Int, GHC.Types.Int) -> a_azz -> m_azy () [LclId] Main.updateMatrix = \ (@ (m_azC :: * -> *)) (@ a_azD) ($dPrimMonad_azE :: Control.Monad.Primitive.PrimMonad m_azC) -> let { $dMonad_ayF :: GHC.Base.Monad m_azC [LclId] $dMonad_ayF = Control.Monad.Primitive.$p1PrimMonad @ m_azC $dPrimMonad_azE } in \ (m_ays :: Data.Vector.Mutable.MVector (Control.Monad.Primitive.PrimState m_azC) (Data.Vector.Mutable.MVector (Control.Monad.Primitive.PrimState m_azC) a_azD)) (ds_dM4 :: (GHC.Types.Int, GHC.Types.Int)) (x_ayv :: a_azD) -> case ds_dM4 of _ { (i_ayt, j_ayu) -> GHC.Base.>>= @ m_azC $dMonad_ayF @ (Data.Vector.Mutable.MVector (Control.Monad.Primitive.PrimState m_azC) a_azD) @ () (Data.Vector.Mutable.read @ m_azC @ (Data.Vector.Mutable.MVector (Control.Monad.Primitive.PrimState m_azC) a_azD) $dPrimMonad_azE m_ays i_ayt) (\ (v_ayw :: Data.Vector.Mutable.MVector (Control.Monad.Primitive.PrimState m_azC) a_azD) -> Data.Vector.Mutable.write @ m_azC @ a_azD $dPrimMonad_azE v_ayw j_ayu x_ayv) } Main.createMatrix :: forall (m_aEn :: * -> *) a_aEo. (GHC.Num.Num a_aEo, Control.Monad.Primitive.PrimMonad m_aEn) => (GHC.Types.Int, GHC.Types.Int) -> m_aEn (Data.Vector.Mutable.MVector (Control.Monad.Primitive.PrimState m_aEn) (Data.Vector.Mutable.MVector (Control.Monad.Primitive.PrimState m_aEn) a_aEo)) [LclId] Main.createMatrix = \ (@ (m_aEs :: * -> *)) (@ a_aEt) ($dNum_aEu :: GHC.Num.Num a_aEt) ($dPrimMonad_aEv :: Control.Monad.Primitive.PrimMonad m_aEs) -> let { $dMonad_azP :: GHC.Base.Monad m_aEs [LclId] $dMonad_azP = Control.Monad.Primitive.$p1PrimMonad @ m_aEs $dPrimMonad_aEv } in \ (ds_dMj :: (GHC.Types.Int, GHC.Types.Int)) -> case ds_dMj of _ { (vsize_ay5, ksize_ay6) -> GHC.Base.>>= @ m_aEs $dMonad_azP @ (Data.Vector.Mutable.MVector (Control.Monad.Primitive.PrimState m_aEs) (Data.Vector.Mutable.MVector (Control.Monad.Primitive.PrimState m_aEs) a_aEt)) @ (Data.Vector.Mutable.MVector (Control.Monad.Primitive.PrimState m_aEs) (Data.Vector.Mutable.MVector (Control.Monad.Primitive.PrimState m_aEs) a_aEt)) (Data.Vector.Mutable.new @ m_aEs @ (Data.Vector.Mutable.MVector (Control.Monad.Primitive.PrimState m_aEs) a_aEt) $dPrimMonad_aEv vsize_ay5) (\ (m_ay7 :: Data.Vector.Mutable.MVector (Control.Monad.Primitive.PrimState m_aEs) (Data.Vector.Mutable.MVector (Control.Monad.Primitive.PrimState m_aEs) a_aEt)) -> GHC.Base.>> @ m_aEs $dMonad_azP @ () @ (Data.Vector.Mutable.MVector (Control.Monad.Primitive.PrimState m_aEs) (Data.Vector.Mutable.MVector (Control.Monad.Primitive.PrimState m_aEs) a_aEt)) (GHC.Base.$ @ (GHC.Types.Int -> m_aEs ()) @ (m_aEs ()) (Control.Monad.forM_ @ GHC.Types.Int @ m_aEs @ () $dMonad_azP (GHC.Enum.enumFromTo @ GHC.Types.Int GHC.Enum.$fEnumInt (GHC.Types.I# 0) (GHC.Num.- @ GHC.Types.Int GHC.Num.$fNumInt vsize_ay5 (GHC.Types.I# 1)))) (\ (i_ayq :: GHC.Types.Int) -> GHC.Base.>>= @ m_aEs $dMonad_azP @ (Data.Vector.Mutable.MVector (Control.Monad.Primitive.PrimState m_aEs) a_aEt) @ () (Data.Vector.Mutable.new @ m_aEs @ a_aEt $dPrimMonad_aEv ksize_ay6) (\ (v_ayr :: Data.Vector.Mutable.MVector (Control.Monad.Primitive.PrimState m_aEs) a_aEt) -> GHC.Base.>> @ m_aEs $dMonad_azP @ () @ () (Data.Vector.Mutable.set @ m_aEs @ a_aEt $dPrimMonad_aEv v_ayr (GHC.Num.fromInteger @ a_aEt $dNum_aEu (__integer 0))) (Data.Vector.Mutable.write @ m_aEs @ (Data.Vector.Mutable.MVector (Control.Monad.Primitive.PrimState m_aEs) a_aEt) $dPrimMonad_aEv m_ay7 i_ayq v_ayr)))) (GHC.Base.return @ m_aEs $dMonad_azP @ (Data.Vector.Mutable.MVector (Control.Monad.Primitive.PrimState m_aEs) (Data.Vector.Mutable.MVector (Control.Monad.Primitive.PrimState m_aEs) a_aEt)) m_ay7)) } $dShow_aJR :: GHC.Show.Show [Data.Vector.Mutable.MVector GHC.Prim.RealWorld (GHC.Prim.Any *)] [LclId] $dShow_aJR = GHC.Show.$fShow[] @ (Data.Vector.Mutable.MVector GHC.Prim.RealWorld (GHC.Prim.Any *)) $dShow_aLp cobox_aFM :: Data.Vector.Vector (Data.Vector.Mutable.MVector GHC.Prim.RealWorld (GHC.Prim.Any *)) ~ Data.Vector.Generic.Base.Mutable (GHC.Prim.Any (* -> *)) (Control.Monad.Primitive.PrimState GHC.Types.IO) (Data.Vector.Mutable.MVector GHC.Prim.RealWorld (GHC.Prim.Any *)) [LclId] cobox_aFM = case cobox_aKH of _ { GHC.Types.Eq# cobox_dMX -> GHC.Types.Eq# @ * @ (Data.Vector.Vector (Data.Vector.Mutable.MVector GHC.Prim.RealWorld (GHC.Prim.Any *))) @ (Data.Vector.Generic.Base.Mutable v_t1O (Control.Monad.Primitive.PrimState GHC.Types.IO) (Data.Vector.Mutable.MVector GHC.Prim.RealWorld (GHC.Prim.Any *))) @~ (cobox_dMX <Data.Vector.Mutable.MVector GHC.Prim.RealWorld (GHC.Prim.Any *)>) } Main.main :: GHC.Types.IO () [LclIdX] Main.main = GHC.Base.>>= @ GHC.Types.IO GHC.Base.$fMonadIO @ (Data.Vector.Vector (Data.Vector.Mutable.MVector GHC.Prim.RealWorld (GHC.Prim.Any *))) @ () (((\ (@ (m_aFh :: * -> *)) (@ a_aFi) ($dNum_aFj :: GHC.Num.Num a_aFi) ($dPrimMonad_aFk :: Control.Monad.Primitive.PrimMonad m_aFh) -> let { $dMonad_aEI :: GHC.Base.Monad m_aFh [LclId] $dMonad_aEI = Control.Monad.Primitive.$p1PrimMonad @ m_aFh $dPrimMonad_aFk } in \ (vsize_ay2 :: GHC.Types.Int) (ksize_ay3 :: GHC.Types.Int) -> GHC.Base.>>= @ m_aFh $dMonad_aEI @ (Data.Vector.Mutable.MVector (Control.Monad.Primitive.PrimState m_aFh) (Data.Vector.Mutable.MVector (Control.Monad.Primitive.PrimState m_aFh) a_aFi)) @ (Data.Vector.Vector (Data.Vector.Mutable.MVector (Control.Monad.Primitive.PrimState m_aFh) a_aFi)) (Main.createMatrix @ m_aFh @ a_aFi $dNum_aFj $dPrimMonad_aFk (vsize_ay2, ksize_ay3)) (\ (matrix_ay4 :: Data.Vector.Mutable.MVector (Control.Monad.Primitive.PrimState m_aFh) (Data.Vector.Mutable.MVector (Control.Monad.Primitive.PrimState m_aFh) a_aFi)) -> GHC.Base.>> @ m_aFh $dMonad_aEI @ () @ (Data.Vector.Vector (Data.Vector.Mutable.MVector (Control.Monad.Primitive.PrimState m_aFh) a_aFi)) (Main.updateMatrix @ m_aFh @ a_aFi $dPrimMonad_aFk matrix_ay4 (GHC.Types.I# 1, GHC.Types.I# 1) (GHC.Num.fromInteger @ a_aFi $dNum_aFj (__integer 2))) (Data.Vector.unsafeFreeze @ m_aFh @ (Data.Vector.Mutable.MVector (Control.Monad.Primitive.PrimState m_aFh) a_aFi) $dPrimMonad_aFk matrix_ay4))) @ GHC.Types.IO @ (GHC.Prim.Any *) $dNum_aFz Control.Monad.Primitive.$fPrimMonadIO (GHC.Types.I# 3) (GHC.Types.I# 3)) `cast` (GHC.Types.IO (Data.Vector.Vector (Data.Vector.Mutable.MVector <(Control.Monad.Primitive.TFCo:R:PrimStateIO)> <GHC.Prim.Any *>)) :: GHC.Types.IO (Data.Vector.Vector (Data.Vector.Mutable.MVector (Control.Monad.Primitive.PrimState GHC.Types.IO) (GHC.Prim.Any *))) ~# GHC.Types.IO (Data.Vector.Vector (Data.Vector.Mutable.MVector GHC.Prim.RealWorld (GHC.Prim.Any *))))) (\ (v_avn :: Data.Vector.Vector (Data.Vector.Mutable.MVector GHC.Prim.RealWorld (GHC.Prim.Any *))) -> GHC.Base.>>= @ GHC.Types.IO GHC.Base.$fMonadIO @ (GHC.Prim.Any (* -> *) (Data.Vector.Mutable.MVector GHC.Prim.RealWorld (GHC.Prim.Any *))) @ () (Data.Vector.Generic.unsafeFreeze @ (GHC.Prim.Any (* -> *)) @ GHC.Types.IO @ (Data.Vector.Mutable.MVector GHC.Prim.RealWorld (GHC.Prim.Any *)) Control.Monad.Primitive.$fPrimMonadIO $dVector_aFL (case cobox_aFM of _ { GHC.Types.Eq# cobox_dN4 -> v_avn `cast` (cobox_dN4 :: Data.Vector.Vector (Data.Vector.Mutable.MVector GHC.Prim.RealWorld (GHC.Prim.Any *)) ~# Data.Vector.Generic.Base.Mutable (GHC.Prim.Any (* -> *)) (Control.Monad.Primitive.PrimState GHC.Types.IO) (Data.Vector.Mutable.MVector GHC.Prim.RealWorld (GHC.Prim.Any *))) })) (\ (iv_avo :: GHC.Prim.Any (* -> *) (Data.Vector.Mutable.MVector GHC.Prim.RealWorld (GHC.Prim.Any *))) -> GHC.Base.$ @ (GHC.Prim.Any (* -> *) (Data.Vector.Mutable.MVector GHC.Prim.RealWorld (GHC.Prim.Any *))) @ (GHC.Types.IO ()) (GHC.Base.. @ [Data.Vector.Mutable.MVector GHC.Prim.RealWorld (GHC.Prim.Any *)] @ (GHC.Types.IO ()) @ (GHC.Prim.Any (* -> *) (Data.Vector.Mutable.MVector GHC.Prim.RealWorld (GHC.Prim.Any *))) (System.IO.print @ [Data.Vector.Mutable.MVector GHC.Prim.RealWorld (GHC.Prim.Any *)] $dShow_aJR) (Data.Vector.Generic.toList @ (GHC.Prim.Any (* -> *)) @ (Data.Vector.Mutable.MVector GHC.Prim.RealWorld (GHC.Prim.Any *)) $dVector_aFL)) iv_avo)) :Main.main :: GHC.Types.IO () [LclIdX] :Main.main = GHC.TopHandler.runMainIO @ () Main.main end Rec } *** End of Offense *** <no location info>: Compilation had errors -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8382#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#8382: ghc unhappy with program who want to program in C in haskell... -------------------------------------+------------------------------------ Reporter: wagle | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------ Changes (by rwbarton): * status: new => closed * resolution: => fixed Comment: Thanks for the report. Your bug is already fixed in HEAD: {{{ rwbarton@adjunction:/tmp$ ~/dist/ghc/inplace/bin/ghc-stage2 test1 -fforce- recomp [1 of 1] Compiling Main ( test1.hs, test1.o ) test1.hs:14:25: Couldn't match type ‛IV.Vector’ with ‛GV.Mutable v0 RealWorld’ The type variable ‛v0’ is ambiguous Expected type: GV.Mutable v0 (Control.Monad.Primitive.PrimState IO) (MV.MVector RealWorld a0) Actual type: IV.Vector (MV.MVector RealWorld a0) In the first argument of ‛GV.unsafeFreeze’, namely ‛v’ In a stmt of a 'do' block: iv <- GV.unsafeFreeze v }}} (In lines 20 & 14, you try to `unsafeFreeze` the result of `unsafeFreeze`. Line 14 should involve some kind of `traverse unsafeFreeze`.) -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8382#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC