llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
27.11k stars 11.1k forks source link

clang crashes while compiling #91166

Open Florikoeln opened 2 months ago

Florikoeln commented 2 months ago

I compiled a file on a new set-up raspberry pi Zero W. The library compiled many times before - even on the same raspberry pi. Please find the output below, the two requested files are attached.; due to security settings I had to change the filename.

PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.

Stack dump:
0.      Program arguments: clang -fPIC -c -Wall -Werror -o /home/fkubo/.local/lib/objects/fk_tools.o -O -I /home/fkubo/gitfolder/fk_tools/include -I /usr/include/libxml2 /home/fkubo/gitfolder/fk_tools/source/fk_tools.c
1.      <eof> parser at end of file
2.      Code generation
3.      Running pass 'Function Pass Manager' on module '/home/fkubo/gitfolder/fk_tools/source/fk_tools.c'.
4.      Running pass 'AArch64 Assembly Printer' on function '@fk_sseed_xosh'
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
/lib/aarch64-linux-gnu/libLLVM-14.so.1(_ZN4llvm3sys15PrintStackTraceERNS_11raw_ostreamEi+0x44)[0x7fa0cde4dc]
/lib/aarch64-linux-gnu/libLLVM-14.so.1(_ZN4llvm3sys17RunSignalHandlersEv+0x70)[0x7fa0cdc4b4]
/lib/aarch64-linux-gnu/libLLVM-14.so.1(+0xdcb1c0)[0x7fa0c0b1c0]
linux-vdso.so.1(__kernel_rt_sigreturn+0x0)[0x7fa95497b0]
/lib/aarch64-linux-gnu/libLLVM-14.so.1(+0x132a9f0)[0x7fa116a9f0]
/lib/aarch64-linux-gnu/libLLVM-14.so.1(_ZN4llvm11raw_ostream5writeEPKcm+0x164)[0x7fa0cbb49c]
/lib/aarch64-linux-gnu/libLLVM-14.so.1(_ZN4llvm9MCContext16createTempSymbolERKNS_5TwineEb+0xb4)[0x7fa2071048]
/lib/aarch64-linux-gnu/libLLVM-14.so.1(_ZN4llvm9MCContext16createTempSymbolEv+0x3c)[0x7fa20713f0]
/lib/aarch64-linux-gnu/libLLVM-14.so.1(_ZN4llvm16MCObjectStreamer18emitCFIEndProcImplERNS_16MCDwarfFrameInfoE+0x1c)[0x7fa2095c6c]
/lib/aarch64-linux-gnu/libLLVM-14.so.1(+0x165f4c0)[0x7fa149f4c0]
/lib/aarch64-linux-gnu/libLLVM-14.so.1(_ZN4llvm10AsmPrinter16emitFunctionBodyEv+0x264c)[0x7fa1480b6c]
/lib/aarch64-linux-gnu/libLLVM-14.so.1(+0x2764ba4)[0x7fa25a4ba4]
/lib/aarch64-linux-gnu/libLLVM-14.so.1(_ZN4llvm19MachineFunctionPass13runOnFunctionERNS_8FunctionE+0x140)[0x7fa103122c]
/lib/aarch64-linux-gnu/libLLVM-14.so.1(_ZN4llvm13FPPassManager13runOnFunctionERNS_8FunctionE+0x26c)[0x7fa0e14390]
/lib/aarch64-linux-gnu/libLLVM-14.so.1(_ZN4llvm13FPPassManager11runOnModuleERNS_6ModuleE+0x3c)[0x7fa0e1af70]
/lib/aarch64-linux-gnu/libLLVM-14.so.1(_ZN4llvm6legacy15PassManagerImpl3runERNS_6ModuleE+0x7b4)[0x7fa0e14d98]
/lib/aarch64-linux-gnu/libclang-cpp.so.14(_ZN5clang17EmitBackendOutputERNS_17DiagnosticsEngineERKNS_19HeaderSearchOptionsERKNS_14CodeGenOptionsERKNS_13TargetOptionsERKNS_11LangOptionsEN4llvm9StringRefEPNSE_6ModuleENS_13BackendActionESt10unique_ptrINSE_17raw_pwrite_streamESt14default_deleteISK_EE+0xad0)[0x7fa791c680]
/lib/aarch64-linux-gnu/libclang-cpp.so.14(+0x1b06f20)[0x7fa7bd6f20]
/lib/aarch64-linux-gnu/libclang-cpp.so.14(_ZN5clang8ParseASTERNS_4SemaEbb+0x210)[0x7fa6b16f1c]
/lib/aarch64-linux-gnu/libclang-cpp.so.14(_ZN5clang14FrontendAction7ExecuteEv+0x80)[0x7fa84d4444]
/lib/aarch64-linux-gnu/libclang-cpp.so.14(_ZN5clang16CompilerInstance13ExecuteActionERNS_14FrontendActionE+0x328)[0x7fa8447d28]
/lib/aarch64-linux-gnu/libclang-cpp.so.14(_ZN5clang25ExecuteCompilerInvocationEPNS_16CompilerInstanceE+0x218)[0x7fa8547d20]
clang(_Z8cc1_mainN4llvm8ArrayRefIPKcEES2_Pv+0x810)[0x413608]
clang[0x411df4]
/lib/aarch64-linux-gnu/libclang-cpp.so.14(+0x207c5fc)[0x7fa814c5fc]
/lib/aarch64-linux-gnu/libLLVM-14.so.1(_ZN4llvm20CrashRecoveryContext9RunSafelyENS_12function_refIFvvEEE+0xcc)[0x7fa0c0ae94]
/lib/aarch64-linux-gnu/libclang-cpp.so.14(_ZNK5clang6driver10CC1Command7ExecuteEN4llvm8ArrayRefINS2_8OptionalINS2_9StringRefEEEEEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPb+0x120)[0x7fa814c000]
/lib/aarch64-linux-gnu/libclang-cpp.so.14(_ZNK5clang6driver11Compilation14ExecuteCommandERKNS0_7CommandERPS3_+0x2b0)[0x7fa8120f50]
/lib/aarch64-linux-gnu/libclang-cpp.so.14(_ZNK5clang6driver11Compilation11ExecuteJobsERKNS0_7JobListERN4llvm15SmallVectorImplISt4pairIiPKNS0_7CommandEEEE+0x7c)[0x7fa812118c]
/lib/aarch64-linux-gnu/libclang-cpp.so.14(_ZN5clang6driver6Driver18ExecuteCompilationERNS0_11CompilationERN4llvm15SmallVectorImplISt4pairIiPKNS0_7CommandEEEE+0xd8)[0x7fa81350c4]
clang(main+0x23d4)[0x411648]
/lib/aarch64-linux-gnu/libc.so.6(+0x27780)[0x7f9f9b7780]
/lib/aarch64-linux-gnu/libc.so.6(__libc_start_main+0x98)[0x7f9f9b7858]
clang(_start+0x30)[0x40eef0]
clang: error: clang frontend command failed with exit code 139 (use -v to see invocation)
Debian clang version 14.0.6
Target: aarch64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
clang: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /tmp/fk_tools-548dc2.c
clang: note: diagnostic msg: /tmp/fk_tools-548dc2.sh
clang: note: diagnostic msg:
[fk_tools-548dc2_sh.txt](https://github.com/llvm/llvm-project/files/15217387/fk_tools-548dc2_sh.txt)
zyn0217 commented 2 months ago

@Florikoeln No files are actually attached. Can you please check it again?

llvmbot commented 2 months ago

@llvm/issue-subscribers-backend-aarch64

Author: None (Florikoeln)

I compiled a file on a new set-up raspberry pi Zero W. The library compiled many times before - even on the same raspberry pi. Please find the output below, the two requested files are [attached.]([fk_tools-548dc2_c.txt](https://github.com/llvm/llvm-project/files/15217386/fk_tools-548dc2_c.txt)); due to security settings I had to change the filename. ``` PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script. Stack dump: 0. Program arguments: clang -fPIC -c -Wall -Werror -o /home/fkubo/.local/lib/objects/fk_tools.o -O -I /home/fkubo/gitfolder/fk_tools/include -I /usr/include/libxml2 /home/fkubo/gitfolder/fk_tools/source/fk_tools.c 1. <eof> parser at end of file 2. Code generation 3. Running pass 'Function Pass Manager' on module '/home/fkubo/gitfolder/fk_tools/source/fk_tools.c'. 4. Running pass 'AArch64 Assembly Printer' on function '@fk_sseed_xosh' Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it): /lib/aarch64-linux-gnu/libLLVM-14.so.1(_ZN4llvm3sys15PrintStackTraceERNS_11raw_ostreamEi+0x44)[0x7fa0cde4dc] /lib/aarch64-linux-gnu/libLLVM-14.so.1(_ZN4llvm3sys17RunSignalHandlersEv+0x70)[0x7fa0cdc4b4] /lib/aarch64-linux-gnu/libLLVM-14.so.1(+0xdcb1c0)[0x7fa0c0b1c0] linux-vdso.so.1(__kernel_rt_sigreturn+0x0)[0x7fa95497b0] /lib/aarch64-linux-gnu/libLLVM-14.so.1(+0x132a9f0)[0x7fa116a9f0] /lib/aarch64-linux-gnu/libLLVM-14.so.1(_ZN4llvm11raw_ostream5writeEPKcm+0x164)[0x7fa0cbb49c] /lib/aarch64-linux-gnu/libLLVM-14.so.1(_ZN4llvm9MCContext16createTempSymbolERKNS_5TwineEb+0xb4)[0x7fa2071048] /lib/aarch64-linux-gnu/libLLVM-14.so.1(_ZN4llvm9MCContext16createTempSymbolEv+0x3c)[0x7fa20713f0] /lib/aarch64-linux-gnu/libLLVM-14.so.1(_ZN4llvm16MCObjectStreamer18emitCFIEndProcImplERNS_16MCDwarfFrameInfoE+0x1c)[0x7fa2095c6c] /lib/aarch64-linux-gnu/libLLVM-14.so.1(+0x165f4c0)[0x7fa149f4c0] /lib/aarch64-linux-gnu/libLLVM-14.so.1(_ZN4llvm10AsmPrinter16emitFunctionBodyEv+0x264c)[0x7fa1480b6c] /lib/aarch64-linux-gnu/libLLVM-14.so.1(+0x2764ba4)[0x7fa25a4ba4] /lib/aarch64-linux-gnu/libLLVM-14.so.1(_ZN4llvm19MachineFunctionPass13runOnFunctionERNS_8FunctionE+0x140)[0x7fa103122c] /lib/aarch64-linux-gnu/libLLVM-14.so.1(_ZN4llvm13FPPassManager13runOnFunctionERNS_8FunctionE+0x26c)[0x7fa0e14390] /lib/aarch64-linux-gnu/libLLVM-14.so.1(_ZN4llvm13FPPassManager11runOnModuleERNS_6ModuleE+0x3c)[0x7fa0e1af70] /lib/aarch64-linux-gnu/libLLVM-14.so.1(_ZN4llvm6legacy15PassManagerImpl3runERNS_6ModuleE+0x7b4)[0x7fa0e14d98] /lib/aarch64-linux-gnu/libclang-cpp.so.14(_ZN5clang17EmitBackendOutputERNS_17DiagnosticsEngineERKNS_19HeaderSearchOptionsERKNS_14CodeGenOptionsERKNS_13TargetOptionsERKNS_11LangOptionsEN4llvm9StringRefEPNSE_6ModuleENS_13BackendActionESt10unique_ptrINSE_17raw_pwrite_streamESt14default_deleteISK_EE+0xad0)[0x7fa791c680] /lib/aarch64-linux-gnu/libclang-cpp.so.14(+0x1b06f20)[0x7fa7bd6f20] /lib/aarch64-linux-gnu/libclang-cpp.so.14(_ZN5clang8ParseASTERNS_4SemaEbb+0x210)[0x7fa6b16f1c] /lib/aarch64-linux-gnu/libclang-cpp.so.14(_ZN5clang14FrontendAction7ExecuteEv+0x80)[0x7fa84d4444] /lib/aarch64-linux-gnu/libclang-cpp.so.14(_ZN5clang16CompilerInstance13ExecuteActionERNS_14FrontendActionE+0x328)[0x7fa8447d28] /lib/aarch64-linux-gnu/libclang-cpp.so.14(_ZN5clang25ExecuteCompilerInvocationEPNS_16CompilerInstanceE+0x218)[0x7fa8547d20] clang(_Z8cc1_mainN4llvm8ArrayRefIPKcEES2_Pv+0x810)[0x413608] clang[0x411df4] /lib/aarch64-linux-gnu/libclang-cpp.so.14(+0x207c5fc)[0x7fa814c5fc] /lib/aarch64-linux-gnu/libLLVM-14.so.1(_ZN4llvm20CrashRecoveryContext9RunSafelyENS_12function_refIFvvEEE+0xcc)[0x7fa0c0ae94] /lib/aarch64-linux-gnu/libclang-cpp.so.14(_ZNK5clang6driver10CC1Command7ExecuteEN4llvm8ArrayRefINS2_8OptionalINS2_9StringRefEEEEEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPb+0x120)[0x7fa814c000] /lib/aarch64-linux-gnu/libclang-cpp.so.14(_ZNK5clang6driver11Compilation14ExecuteCommandERKNS0_7CommandERPS3_+0x2b0)[0x7fa8120f50] /lib/aarch64-linux-gnu/libclang-cpp.so.14(_ZNK5clang6driver11Compilation11ExecuteJobsERKNS0_7JobListERN4llvm15SmallVectorImplISt4pairIiPKNS0_7CommandEEEE+0x7c)[0x7fa812118c] /lib/aarch64-linux-gnu/libclang-cpp.so.14(_ZN5clang6driver6Driver18ExecuteCompilationERNS0_11CompilationERN4llvm15SmallVectorImplISt4pairIiPKNS0_7CommandEEEE+0xd8)[0x7fa81350c4] clang(main+0x23d4)[0x411648] /lib/aarch64-linux-gnu/libc.so.6(+0x27780)[0x7f9f9b7780] /lib/aarch64-linux-gnu/libc.so.6(__libc_start_main+0x98)[0x7f9f9b7858] clang(_start+0x30)[0x40eef0] clang: error: clang frontend command failed with exit code 139 (use -v to see invocation) Debian clang version 14.0.6 Target: aarch64-unknown-linux-gnu Thread model: posix InstalledDir: /usr/bin clang: note: diagnostic msg: ******************** PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT: Preprocessed source(s) and associated run script(s) are located at: clang: note: diagnostic msg: /tmp/fk_tools-548dc2.c clang: note: diagnostic msg: /tmp/fk_tools-548dc2.sh clang: note: diagnostic msg: [fk_tools-548dc2_sh.txt](https://github.com/llvm/llvm-project/files/15217387/fk_tools-548dc2_sh.txt) ```
Florikoeln commented 2 months ago

@Florikoeln No files are actually attached. Can you please check it again?

fk_tools-548dc2_c.txt fk_tools-548dc2_sh.txt

I hope this time it worked. Please note that our company regulations allow no .c and no .sh-files, therefore I changed the filename to .txt.

peterwaller-arm commented 2 months ago

I've attempted to reproduce, building on an aarch64 machine under a debian 12 (bookworm) docker container. It's llvm 14.0.6; I wasn't able to get a crash. The reproducer doesn't fire on the main branch (with asserts) for me either.

Can you confirm that running the reproducer script does reproduce the crash for you and that this isn't a transient issue? Under a debian 12 docker container I'm running fk_tools-548dc2.sh and this gives me an object file as output of size 7568 bytes.

(edited to add) My docker image repro bits, running docker run -ti --rm -v $PWD:$PWD -w $PWD debian:

        "Id": "sha256:dc0de672ed1226c65f85607f60b58c8fd94abdb7eba38cb172d056a430ce548e",
        "RepoTags": [
            "debian:latest"
        ],
        "RepoDigests": [
            "debian@sha256:1aadfee8d292f64b045adb830f8a58bfacc15789ae5f489a0fedcd517a862cb9"
        ],
Florikoeln commented 2 months ago

I updated the raspi (sudo apt update / upgrade), and tried again: clang still crashes