Bug 2259420 - [aarch64, ppc64le, s390x] gcc-14 fails to compile ghc9.6 RTS
Summary: [aarch64, ppc64le, s390x] gcc-14 fails to compile ghc9.6 RTS
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: ghc9.6
Version: rawhide
Hardware: Unspecified
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Jens Petersen
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2024-01-21 14:31 UTC by Jens Petersen
Modified: 2024-01-22 09:07 UTC (History)
12 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2024-01-22 09:07:25 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Jens Petersen 2024-01-21 14:31:04 UTC
(I also reported this to ghc upstream: https://gitlab.haskell.org/ghc/ghc/-/issues/24348)

ghc-9.6 RTS is failing to compile with current gcc-14 in Rawhide.
There is not that much C code in ghc but the RTS is obviously quite sensitive and critical code.


Reproducible: Always

Steps to Reproduce:
1. build ghc9.6 on aarch64 in Rawhide

Actual Results:  
Quoting from the above issue:

The errors look like this:
https://koji.fedoraproject.org/koji/taskinfo?taskID=112042120
https://koji.fedoraproject.org/koji/getfile?taskID=112042120&name=build.log&offset=-60000

| Run Ghc CompileCWithGhc Stage1: rts/Task.c => _build/stage1/rts/build/c/Task.thr_o
| Run Ghc CompileCWithGhc Stage1: rts/adjustor/LibffiAdjustor.c => _build/stage1/rts/build/c/adjustor/LibffiAdjustor.o
Command line: _build/stage0/bin/ghc -Wall -hisuf hi -osuf o -hcsuf hc -static -hide-all-packages -no-user-package-db '-package-env -' '-package-db _build/stage1/inplace/package.conf.d' '-this-unit-id rts-1.0.2' -i -i/builddir/build/BUILD/ghc-9.6.4/_build/stage1/rts/build -i/builddir/build/BUILD/ghc-9.6.4/_build/stage1/rts/build/autogen -i/builddir/build/BUILD/ghc-9.6.4/rts -Irts/include -I_build/stage1/rts/build -I_build/stage1/rts/build/include -I_build/stage1/rts/build/@FFIIncludeDir@ -I_build/stage1/rts/build/@LibdwIncludeDir@ -Irts/include -Irts/@FFIIncludeDir@ -Irts/@LibdwIncludeDir@ -optP-include -optP_build/stage1/rts/build/autogen/cabal_macros.h -ghcversion-file=rts/include/ghcversion.h -outputdir _build/stage1/rts/build -optc-Irts/include -optc-I_build/stage1/rts/build -optc-I_build/stage1/rts/build/include -optc-I_build/stage1/rts/build/@FFIIncludeDir@ -optc-I_build/stage1/rts/build/@LibdwIncludeDir@ -optc-Irts/include -optc-Irts/@FFIIncludeDir@ -optc-Irts/@LibdwIncludeDir@ -Wnoncanonical-monad-instances -optc-Wno-error=inline -optP-Wno-nonportable-include-path -c rts/adjustor/LibffiAdjustor.c -o _build/stage1/rts/build/c/adjustor/LibffiAdjustor.o -O0 -H64m -this-unit-id rts -XHaskell98 -no-global-package-db -package-db=/builddir/build/BUILD/ghc-9.6.4/_build/stage1/inplace/package.conf.d -ghcversion-file=rts/include/ghcversion.h -ghcversion-file=rts/include/ghcversion.h -O -optc-Wall -optc-Wextra -optc-Wstrict-prototypes -optc-Wmissing-prototypes -optc-Wmissing-declarations -optc-Winline -optc-Wpointer-arith -optc-Wmissing-noreturn -optc-Wnested-externs -optc-Wredundant-decls -optc-Wundef -optc-fno-strict-aliasing -optc-fomit-frame-pointer -optc-O2 -optc-Irts -optc-I_build/stage1/rts/build -Irts -I_build/stage1/rts/build '-DRtsWay="rts_v"' -DFS_NAMESPACE=rts -DCOMPILING_RTS -Wno-deprecated-flags -Wcpp-undef
===> Command failed with error code: 1
rts/adjustor/LibffiAdjustor.c: In function ‘allocate_adjustor’:
rts/adjustor/LibffiAdjustor.c:42:43: error:
     error: passing argument 1 of ‘ffi_alloc_prep_closure’ from incompatible pointer type [-Wincompatible-pointer-types]
       42 |     ffi_status r = ffi_alloc_prep_closure(&writ, cif, wptr, hptr, exec_ret);
          |                                           ^~~~~
          |                                           |
          |                                           void **
   |
42 |     ffi_status r = ffi_alloc_prep_closure(&writ, cif, wptr, hptr, exec_ret);
   |                                           ^
rts/adjustor/LibffiAdjustor.c:21:56: error:
     note: expected ‘ffi_closure **’ but argument is of type ‘void **’
       21 | static ffi_status ffi_alloc_prep_closure(ffi_closure **pclosure, ffi_cif *cif,
          |                                          ~~~~~~~~~~~~~~^~~~~~~~
   |
21 | static ffi_status ffi_alloc_prep_closure(ffi_closure **pclosure, ffi_cif *cif,
   |                                                        ^
At top level:
cc1: note: unrecognized command-line option ‘-Wno-nonportable-include-path’ may have been intended to silence earlier diagnostics
`gcc' failed in phase `C Compiler'. (Exit code: 1)
Command failed
Build failed.


Expected Results:  
Compilation to succeed like on Intel archs

I tried setting:

%global build_type_safety_c 0

around the top of ghc9.6.spec but to no avail...
(in fact I tried first 2 and then 1, but still didn't compile on aarch64).

Funnily enough this doesn't happen with ghc9.8, ghc9.4, or ghc9.2.

Comment 1 Jens Petersen 2024-01-21 14:34:16 UTC
Maybe I am using the wrong macro?? I thought specifically -Wincompatible-pointer-types is from level 3?

But I haven't checked this very carefully yet.

Comment 2 Jens Petersen 2024-01-21 14:36:36 UTC
I think ghc8.10 rts is also affected but with a different compilation error.

Comment 3 Jakub Jelinek 2024-01-21 15:15:46 UTC
You really want to fix the code, not try to work around it.
This is not valid C.

Comment 4 Jens Petersen 2024-01-22 04:54:52 UTC
Thanks - okay this was already fixed in ghc upstream for 9.8

Comment 5 Jens Petersen 2024-01-22 04:56:38 UTC
(I think 8.10 failure was unrelated)


Note You need to log in before you can comment on or make changes to this bug.