Skip to content

Programs compiled with GHC 9.2.4 segfault on macOS 13.0 beta (M1/arm64/aarch64)

Summary

ghc-9.2.4-segv% echo 'main = return ()' > Main.hs
ghc-9.2.4-segv% ghc Main.hs 
[1 of 1] Compiling Main             ( Main.hs, Main.o )
Linking Main ...
ghc-9.2.4-segv% ./Main 
fish: Job 1, './Main' terminated by signal SIGSEGV (Address boundary error)

Looks like it's crashing in stg_enter_info:

ghc-9.2.4-segv% ghc -g Main.hs
ghc-9.2.4-segv% lldb ./Main
(lldb) target create "./Main"
Current executable set to '/Users/ii/tmp/ghc-9.2.4-segv/Main' (arm64).
(lldb) run
Process 1789 launched: '/Users/ii/tmp/ghc-9.2.4-segv/Main' (arm64)
Process 1789 stopped
* thread #1, name = 'ghc_ticker', queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
    frame #0: 0x000000010042d45c Main`stg_enter_info + 12
Main`stg_enter_info:
->  0x10042d45c <+12>: ldr    x17, [x18]
    0x10042d460 <+16>: ldur   w15, [x17, #-0x8]
    0x10042d464 <+20>: sxtw   x15, w15
    0x10042d468 <+24>: mov    w14, #0x1a
Target 0: (Main) stopped.

I don't know if it's possible to get a better stack trace.

Steps to reproduce

  1. Install the public beta of Ventura from https://beta.apple.com. I'm on beta 2 at the moment.
  2. Install ghcup in the usual way.
  3. Install GHC 9.2.4 with ghcup install ghc 9.2.4.
  4. Run the commands in the summary above.

Expected behavior

Compiled programs don't crash immediately 🙂

Environment

  • GHC version used: 9.2.4

Specific program versions:

colibri% uname -a
Darwin Ilmaris-MacBook-Air.local 22.0.0 Darwin Kernel Version 22.0.0: Wed Jul 20 01:51:52 PDT 2022; root:xnu-8792.0.188.141.3~2/RELEASE_ARM64_T8103 arm64
colibri% cc --version
Apple clang version 14.0.0 (clang-1400.0.29.100)
Target: arm64-apple-darwin22.0.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
colibri% ghc --version
The Glorious Glasgow Haskell Compilation System, version 9.2.4

Optional:

  • Operating System: macOS Ventura 13.0 beta 2
  • System Architecture: Apple M1
Edited by Ilmari Vacklin
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information