Description of problem: The following build of ocaml segfaults on Fedora/RISCV F37: http://fedora.riscv.rocks/koji/taskinfo?taskID=1218748 [..] make[2]: Entering directory '/builddir/build/BUILD/ocaml-4.14.0/ocamldoc' ../ocamlopt.opt -nostdlib -I ../stdlib -I ../utils -I ../parsing -I ../typing -I ../driver -I ../bytecomp -I ../toplevel -I ../stdlib -I ../compilerlibs -I ../otherlibs/str -I ../otherlibs/dynlink -I ../otherlibs/dynlink/native -I ../otherlibs/unix -absname -w +a-4-9-41-42-44-45-48-70 -warn-error +A -safe-string -strict-sequence -strict-formats -bin-annot -principal -c odoc_config.ml make[2]: *** [Makefile:216: odoc_config.cmx] Segmentation fault (core dumped) make[2]: Leaving directory '/builddir/build/BUILD/ocaml-4.14.0/ocamldoc' make[1]: *** [Makefile:930: ocamldoc.opt] Error 2 make[1]: *** Waiting for unfinished jobs.... [..] Compiled on SiFive HiFive Unmatched board (-j4, 16G RAM).
Core was generated by `../ocamlopt.opt -nostdlib -I ../stdlib -I ../utils -I ../parsing -I ../typing -'. Program terminated with signal SIGSEGV, Segmentation fault. #0 0x0000002ace567a18 in camlMain_args__87 () Missing separate debuginfos, use: dnf debuginfo-install glibc-2.32-10.fc33.riscv64 (gdb) bt #0 0x0000002ace567a18 in camlMain_args__87 () #1 0x0000002ace18848c in camlCamlinternalFormat__make_printf_3510 () at camlinternalFormat.ml:1548 #2 0x0000002ace149e4c in camlMain_args__mk_dump_pass_707 () at format.ml:1396 #3 0x0000002ace14f286 in camlMain_args__Make_optcomp_options_2069 () at driver/main_args.ml:1496 #4 0x0000002acdf8b8f4 in camlOptmaindriver__entry () at driver/optmaindriver.ml:37 #5 0x0000002acdeb2210 in caml_program () #6 0x0000002ace1ac56e in caml_start_program () #7 0x0000002acded5ed8 in caml_startup_common (argv=0x100000000000005, pooling=<optimized out>, pooling@entry=0) at runtime/startup_nat.c:160 #8 0x0000002acded5f14 in caml_startup_exn (argv=<optimized out>) at runtime/startup_nat.c:167 #9 caml_startup (argv=<optimized out>) at runtime/startup_nat.c:172 #10 0x0000002acdeb065a in caml_main (argv=<optimized out>) at runtime/startup_nat.c:179 #11 main (argc=<optimized out>, argv=<optimized out>) at runtime/main.c:37 (gdb) frame 1 #1 0x0000002ace18848c in camlCamlinternalFormat__make_printf_3510 () at camlinternalFormat.ml:1548 1548 make_custom k acc rest arity (f ()) (gdb) frame 0 #0 0x0000002ace567a18 in camlMain_args__87 () (gdb) disassemble Dump of assembler code for function camlMain_args__87: => 0x0000002ace567a18: ld a0,112(a2) 0x0000002ace567a1a: sw s5,28(sp) 0x0000002ace567a1c: c.slli zero,0xa 0x0000002ace567a1e: unimp 0x0000002ace567a20: addi s0,sp,400 0x0000002ace567a22: unimp 0x0000002ace567a24: unimp 0x0000002ace567a26: unimp Registers look fine. I'll see if I can make a small reproducer.
I bisected it to this downstream patch: https://pagure.io/fedora-ocaml/c/41d5e2db7a4667560d6aedda11a3c6a80c8f1b83?branch=fedora-37-4.14.0 I'm testing a fix.
Sorry this fix turned out to be more complicated than I thought. Here's a scratch build (non-riscv64) of the proposed solution to check that it doesn't break primary architectures: https://koji.fedoraproject.org/koji/taskinfo?taskID=91695157
Fixed in ocaml-4.14.0-3.fc37 Note I didn't actually build this package in primary Fedora, intentionally because there is a small dependency change which would break every other OCaml package.