Skip to content

llc crashes while compiling code for arm #165422

@iliastsi

Description

@iliastsi

llc crashes while trying to compile the attached file (ghc_ll.txt) with the following traceback:
https://godbolt.org/z/GzrY6sWbq

Command line: _build/stage0/bin/ghc -Wall -Wcompat -fdiagnostics-color=never -hisuf p_hi -osuf p_o -hcsuf p_hc -static -prof -hide-all-packages -no-user-package-db '-package-env -' '-package-db _build/stage1/inplace/package.conf.d' '-this-unit-id ghc-bignum-1.3-34fd' '-this-package-name ghc-bignum' '-package-id ghc-prim-0.12.0-57da' -i -i/build/reproducible-path/ghc-9.10.3/_build/stage1/libraries/ghc-bignum/build -i/build/reproducible-path/ghc-9.10.3/_build/stage1/libraries/ghc-bignum/build/autogen -i/build/reproducible-path/ghc-9.10.3/libraries/ghc-bignum/src/ -Irts/include -I_build/stage1/libraries/ghc-bignum/build -I_build/stage1/libraries/ghc-bignum/build/include/ -Ilibraries/ghc-bignum/include/ -I/build/reproducible-path/ghc-9.10.3/rts/include -I/build/reproducible-path/ghc-9.10.3/_build/stage1/rts/build/include -optP-include -optP_build/stage1/libraries/ghc-bignum/build/autogen/cabal_macros.h -optc-marm -optP-DBIGNUM_GMP -outputdir _build/stage1/libraries/ghc-bignum/build -Wall -this-unit-id ghc-bignum -fno-catch-nonexhaustive-cases -XHaskell2010 -no-global-package-db -package-db=/build/reproducible-path/ghc-9.10.3/_build/stage1/inplace/package.conf.d -ghcversion-file=rts/include/ghcversion.h -ghcversion-file=rts/include/ghcversion.h -Wnoncanonical-monad-instances -optc-Wno-error=inline -c libraries/ghc-bignum/src/GHC/Num/Backend/Selected.hs -o _build/stage1/libraries/ghc-bignum/build/GHC/Num/Backend/Selected.p_o -fsplit-sections -O -H64m -O2 -haddock -D__ARM_PCS_VFP -Wno-deprecated-flags
===> Command failed with error code: 1
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.	Program arguments: llc-19 -O2 -relocation-model=pic -mcpu=arm1176jzf-s -mattr=+strict-align /tmp/ghc57961_0/ghc_7.bc -o /tmp/ghc57961_0/ghc_8.lm_s
 #0 0xf14585f4 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) build-llvm/tools/clang/stage2-bins/llvm/lib/Support/Unix/Signals.inc:723:13
 #1 0xf1455ff4 llvm::sys::RunSignalHandlers() build-llvm/tools/clang/stage2-bins/llvm/lib/Support/Signals.cpp:0:5
 #2 0xf1458ee8 SignalHandler build-llvm/tools/clang/stage2-bins/llvm/lib/Support/Unix/Signals.inc:0:3
 #3 0xf078ecd0 __default_sa_restorer ./signal/../sysdeps/unix/sysv/linux/arm/sigrestorer.S:67:0
 #4 0xf3a872ac getObjectFormat build-llvm/tools/clang/stage2-bins/llvm/include/llvm/TargetParser/Triple.h:405:53
 #5 0xf3a872ac isOSBinFormatMachO build-llvm/tools/clang/stage2-bins/llvm/include/llvm/TargetParser/Triple.h:740:12
 #6 0xf3a872ac isTargetMachO build-llvm/tools/clang/stage2-bins/llvm/lib/Target/ARM/ARMSubtarget.h:312:52
 #7 0xf3a872ac GetARMGVSymbol build-llvm/tools/clang/stage2-bins/llvm/lib/Target/ARM/ARMAsmPrinter.cpp:861:18
 #8 0xf3a872ac emitXXStructor build-llvm/tools/clang/stage2-bins/llvm/lib/Target/ARM/ARMAsmPrinter.cpp:93:45
 #9 0xf1d58140 llvm::AsmPrinter::emitXXStructorList(llvm::DataLayout const&, llvm::Constant const*, bool) build-llvm/tools/clang/stage2-bins/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:2970:20
#10 0xf1d4d8ac llvm::AsmPrinter::emitSpecialLLVMGlobal(llvm::GlobalVariable const*) build-llvm/tools/clang/stage2-bins/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:0:0
#11 0xf1d4cd70 llvm::AsmPrinter::emitGlobalVariable(llvm::GlobalVariable const*) build-llvm/tools/clang/stage2-bins/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:710:9
#12 0xf1d5515c llvm::AsmPrinter::doFinalization(llvm::Module&) build-llvm/tools/clang/stage2-bins/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:2297:22
#13 0xf15bf8d0 llvm::FPPassManager::doFinalization(llvm::Module&) build-llvm/tools/clang/stage2-bins/llvm/lib/IR/LegacyPassManager.cpp:1503:55
#14 0xf15ba464 runOnModule build-llvm/tools/clang/stage2-bins/llvm/lib/IR/LegacyPassManager.cpp:1590:55
#15 0xf15ba464 llvm::legacy::PassManagerImpl::run(llvm::Module&) build-llvm/tools/clang/stage2-bins/llvm/lib/IR/LegacyPassManager.cpp:541:44
#16 0x00ab3b30 compileModule build-llvm/tools/clang/stage2-bins/llvm/tools/llc/llc.cpp:742:17
#17 0x00ab18c4 main build-llvm/tools/clang/stage2-bins/llvm/tools/llc/llc.cpp:0:22
#18 0xf077f4ba __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:74:3
#19 0xf077f556 call_init ./csu/libc-start.c:128:20
#20 0xf077f556 __libc_start_main ./csu/libc-start.c:347:5
`llc-19' failed in phase `LLVM Compiler'. (Exit code: -11)

I have tried with various LLVM versions from 17 to 21 (all from the official Debian archives).

The attached file is generated by GHC (while compiling GHC), so currently we are unable to build GHC on armv7 (tracked here).

Metadata

Metadata

Assignees

No one assigned

    Labels

    backend:ARMcrashPrefer [crash-on-valid] or [crash-on-invalid]

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions