From 96699b3aad3d4abbe5fa8c0853e3170efb0928fa Mon Sep 17 00:00:00 2001 From: Debian Haskell Group Date: Wed, 10 Apr 2024 14:24:01 +0300 Subject: [PATCH] fix-gcc14-ffi_arg MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit commit 1f534c2e7388273e70534680212c1357614c11ed Author: Florian Weimer Date: Thu Feb 15 15:19:52 2024 +0000 Fix C output for modern C initiative GCC 14 on aarch64 rejects the C code written by GHC with this kind of error: error: assignment to ‘ffi_arg’ {aka ‘long unsigned int’} from ‘HsPtr’ {aka ‘void *’} makes integer from pointer without a cast [-Wint-conversion] 68 | *(ffi_arg*)resp = cret; | ^ Add the correct cast. For more information on this see: https://fedoraproject.org/wiki/Changes/PortingToModernC Tested-by: Richard W.M. Jones Gbp-Pq: Name fix-gcc14-ffi_arg --- compiler/GHC/HsToCore/Foreign/Decl.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/GHC/HsToCore/Foreign/Decl.hs b/compiler/GHC/HsToCore/Foreign/Decl.hs index 68980f5b..4fb1b6f1 100644 --- a/compiler/GHC/HsToCore/Foreign/Decl.hs +++ b/compiler/GHC/HsToCore/Foreign/Decl.hs @@ -681,7 +681,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 ] -- 2.30.2