<div dir="ltr"><div><div>Hey all,</div><div><br></div><div>I'm trying to debug a segfault caused by my optimization. GHC only segfaults when compiled with -O2 and my flag, i.e., I used the "perf" flavour:<br><br>> ./hadrian/build -j "stage1.*.ghc.hs.opts += -fregs-ssa"  --flavour=perf<br><br></div><div>However, I can't get a stack trace.<br></div><div>[1] suggests I need a profiling build for that. So I tried:<br>> ./hadrian/build -j "stage1.*.ghc.hs.opts += -fregs-ssa"  --flavour=perf+debug_info+profiled_ghc+no_dynamic_ghc<br><br></div><div>Unfortunately, I'm using GHC 9.2.1 from ghcup to bootstrap and this version doesn't come with profiling enabled base [2].<br><br></div><div>8.10.7, which I have installed, can't compile ghc anymore (it seems). So I tried 9.2.3 from ghcup and that gives me the strangest errors. Basically, the compiler seems completely bricked.</div><div>I installed 9.2.3, ran "hadrian/build clean", "./configure && ./boot" and the same line as above with both "default" and "perf" flavours.<br><br></div><div>When I try to compile nofib/spectral/simple, I get:<br>> /home/ben/Projekte/haskell/ghc/_build/stage1/bin/ghc -O2 Main.hs<br>> [1 of 2] Compiling Main             ( Main.hs, Main.o )<br><br>> Main.hs:1125:1: error: lexical error (UTF-8 decoding error)<br><br></div><div>(Main.hs only has 1124 lines though, file was not modified, compiles fine with any other ghc version)<br><br></div><div>But most programs I tried give me:<br>> /home/ben/Projekte/haskell/ghc/_build/stage1/bin/ghc -O2 Main.hs<br>> ghc: Unable to commit 283468890112 bytes of memory<br>> ghc: Exiting. The system might be out of memory.<br><br></div><div>Oh kay. I got 16GB RAM, 10 gig available. GHC 9.2.3 works fine.</div><div><br></div>Is my flavour combination bad, or what is broken here?<br></div>Any other (better) way to get an optimized build with all the debugging aids I can get?<br><div><div>I heard GHC 9.2.2 is a broken release, or does anyone know whether it works on Linux x86_64 (and comes with profiling libs from ghcup) - maybe I can get a working version using that?<br><br></div><div>I'd try, but creating a new build takes almost an hour and I have spent most of the day trying to solve this. I am puzzled and desearate to fix my bug and get a working compiler.</div><div><br></div><div>Appreciate any help!</div><div><br></div><div>Best Regards,</div><div>Benjamin<br></div><div><br></div><div><br>[1] <a href="https://gitlab.haskell.org/ghc/ghc/-/blob/master/hadrian/doc/debugging.md">https://gitlab.haskell.org/ghc/ghc/-/blob/master/hadrian/doc/debugging.md</a><br>[2] <a href="https://gitlab.haskell.org/haskell/ghcup-hs/-/issues/296">https://gitlab.haskell.org/haskell/ghcup-hs/-/issues/296</a></div></div></div>