diff --git a/compiler/GHC/HsToCore/Foreign/C.hs b/compiler/GHC/HsToCore/Foreign/C.hs
index 2164ded112d7a0f487e2ab15874cad227814a6a6..8beaa8986ec594e3e98a65ee4d8ca430d8030f01 100644
--- a/compiler/GHC/HsToCore/Foreign/C.hs
+++ b/compiler/GHC/HsToCore/Foreign/C.hs
@@ -560,7 +560,7 @@ mkFExportCBits dflags c_nm maybe_target arg_htys res_hty is_IO_res_ty cc
      ,   ppUnless res_hty_is_unit $
          if libffi
                   then char '*' <> parens (ffi_cResType <> char '*') <>
-                       text "resp = cret;"
+                       text "resp = " <> parens ffi_cResType <> text "cret;"
                   else text "return cret;"
      , rbrace
      ]