From 530b4f47cb129632dfd6f9983eb07a2a4d5b93f0 Mon Sep 17 00:00:00 2001 From: Valentin Robert Date: Thu, 17 Oct 2024 13:59:26 -0700 Subject: [PATCH] fix Reopt indicate function type rather than return type on LLVM calls --- src/Reopt/CFG/LLVM.hs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Reopt/CFG/LLVM.hs b/src/Reopt/CFG/LLVM.hs index 7ef4d9ae..9b2b57c5 100644 --- a/src/Reopt/CFG/LLVM.hs +++ b/src/Reopt/CFG/LLVM.hs @@ -840,11 +840,11 @@ call (valueOf -> f) args = case L.typedType f of L.PtrTo (L.FunTy res _argTypes _varArgs) -> do case res of - L.PrimType L.Void -> do - error "Call expected to return a value, but returns void." - _ -> do - fmap (L.Typed res) $ evalInstr $ L.Call False (L.typedType f) (L.typedValue f) args - _ -> error $ "Call given non-function pointer argument:\n" ++ show f + L.PrimType L.Void -> + error "call: expected to return a value, but returns void." + _ -> + L.Typed res <$> evalInstr (L.Call False res (L.typedValue f) args) + _ -> error $ "call: given non-function pointer argument:\n" ++ show f -- | Generate a non-tail call that does not return a value call_ :: HasValue v => v -> [L.Typed L.Value] -> BBLLVM arch () @@ -852,7 +852,7 @@ call_ (valueOf -> f) args = case L.typedType f of L.PtrTo (L.FunTy (L.PrimType L.Void) _argTypes _varArgs) -> do effect $ L.Call False (L.typedType f) (L.typedValue f) args - _ -> error $ "call_ given non-function pointer argument\n" ++ show f + _ -> error $ "call_: given non-function pointer argument\n" ++ show f -- | Sign extend a boolean value to the given width. carryValue ::