I've tracked down two more bugs...
Number one is about passing void arguments to foreign calls. We definitely don't want to do that, and I guess this is the right place to filter them out, but I'm not entirely sure:
diff -c -r1.56.4.11 CgExpr.lhs
*** codeGen/CgExpr.lhs 5 Feb 2004 12:23:47 -0000 1.56.4.11
--- codeGen/CgExpr.lhs 9 Feb 2004 14:01:13 -0000
***************
*** 129,135 ****
-}
reps_n_amodes <- getArgAmodes args
let
! (_reps, arg_exprs1) = unzip reps_n_amodes
arg_exprs = zipWith shimForeignCallArg args arg_exprs1
-- in
arg_tmps <- mapM assignTemp arg_exprs
--- 129,135 ----
-}
reps_n_amodes <- getArgAmodes args
let
! (_reps, arg_exprs1) = unzip $ filter (nonVoidArg . fst) reps_n_amodes
arg_exprs = zipWith shimForeignCallArg args arg_exprs1
-- in
arg_tmps <- mapM assignTemp arg_exprs
The second one has to do with inline primops returning void:
diff -c -r1.66.4.16 CgCase.lhs
*** codeGen/CgCase.lhs 5 Feb 2004 12:23:34 -0000 1.66.4.16
--- codeGen/CgCase.lhs 9 Feb 2004 14:04:58 -0000
***************
*** 271,279 ****
\begin{code}
cgInlinePrimOp primop args bndr (PrimAlt tycon) live_in_alts alts
= do { -- PRIMITIVE ALTS
! ; tmp_reg <- bindNewToTemp bndr
! ; let res | isVoidArg (idCgRep bndr) = []
! | otherwise = [tmp_reg]
; cgPrimOp res primop args live_in_alts
; cgPrimAlts NoGC (PrimAlt tycon) tmp_reg alts }--- 271,280 ----
\begin{code}
cgInlinePrimOp primop args bndr (PrimAlt tycon) live_in_alts alts
= do { -- PRIMITIVE ALTS
! ; (res, tmp_reg) <- if isVoidArg (idCgRep bndr)
! then return ([], panic "cgInlinePrimOp")
! else do { tmp_reg <- bindNewToTemp bndr
! ; return ([tmp_reg], tmp_reg) }
; cgPrimOp res primop args live_in_alts
; cgPrimAlts NoGC (PrimAlt tycon) tmp_reg alts }Is passing bottom as tmp_reg a good idea?
I'm now up to GHC.ForeignPtr - I've already got 46 modules compiled! :-)
Cheers,
Wolfgang
_______________________________________________ Cvs-ghc mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/cvs-ghc
