HEAD in profiling mode produces segfaulting executables on ancient Ubuntu (16.04)
Edit: @bgamari can't reproduce that, so it must be something with my ancient OS or another random quirk.
~/r/kkkkk$ ~/r/ghc/_build/stage1/bin/ghc --make Main.hs -prof -dcore-lint -dstg-lint -dcmm-lint -dtag-inference-checks
[1 of 2] Compiling Main ( Main.hs, Main.o )
[2 of 2] Linking Main
~/r/kkkkk$ ./Main
Segmentation fault (core dumped)
~/r/kkkkk$ ~/r/ghc/_build/stage1/bin/ghc --version
The Glorious Glasgow Haskell Compilation System, version 9.9.20231113
~/r/kkkkk$ cat Main.hs
module Main (main) where
main :: IO ()
main = print 1
~/r/kkkkk$
Without profiling it works fine, older GHCs work fine (I'm not sure I tried anything newer than 9.4 in profiling mode though).
gdb output:
Program received signal SIGSEGV, Segmentation fault.
0x0000000000000000 in ?? ()
(gdb) bt
#0 0x0000000000000000 in ?? ()
#1 0x000000000050e9ed in __libc_csu_init ()
#2 0x00007ffff74a485f in __libc_start_main (main=0x409658 <main>, argc=1, argv=0x7fffffffdcc8, init=0x50e9a0 <__libc_csu_init>, fini=<optimised out>, rtld_fini=<optimised out>, stack_end=0x7fffffffdcb8) at ../csu/libc-start.c:247
#3 0x00000000004093d9 in _start ()
valgrind output:
~/r/kkkkk$ valgrind ./Main
==15955== Memcheck, a memory error detector
==15955== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==15955== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info
==15955== Command: ./Main
==15955==
==15955== Jump to the invalid address stated on the next line
==15955== at 0x0: ???
==15955== by 0x50E9EC: __libc_csu_init (in /home/mikolaj/r/kkkkk/Main)
==15955== by 0x53E385E: (below main) (libc-start.c:247)
==15955== Address 0x0 is not stack'd, malloc'd or (recently) free'd
==15955==
==15955==
==15955== Process terminating with default action of signal 11 (SIGSEGV)
==15955== Bad permissions for mapped region at address 0x0
==15955== at 0x0: ???
==15955== by 0x50E9EC: __libc_csu_init (in /home/mikolaj/r/kkkkk/Main)
==15955== by 0x53E385E: (below main) (libc-start.c:247)
==15955==
==15955== HEAP SUMMARY:
==15955== in use at exit: 648 bytes in 14 blocks
==15955== total heap usage: 29 allocs, 15 frees, 75,574 bytes allocated
==15955==
==15955== LEAK SUMMARY:
==15955== definitely lost: 0 bytes in 0 blocks
==15955== indirectly lost: 0 bytes in 0 blocks
==15955== possibly lost: 0 bytes in 0 blocks
==15955== still reachable: 648 bytes in 14 blocks
==15955== suppressed: 0 bytes in 0 blocks
==15955== Rerun with --leak-check=full to see details of leaked memory
==15955==
==15955== For counts of detected and suppressed errors, rerun with: -v
==15955== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
Segmentation fault (core dumped)
- Operating System: Ubuntu 16.04.7 LTS
- System Architecture: AMD Ryzen 3 3100 4-Core Processor
GHC is built according to https://ghc.dev/, with the difference that the last step is hadrian/build -j --flavour=release
.
Edited by Mikolaj Konarski