Repository navigation
Compiler Backend Fatal Issues #463
Copy link
Copy link
Closed
Description
Hello, when attempting to compile my project, it returns a fatal issue when O1 or greater is present (Oz works fine). It is a single 800 line long C file, without any external files or dependencies, and it seems like it crashes after compilation and before linking. My repository is here, feel free to git clone it and try it out for yourself. I will paste the output here:
keagan@keagan-MS-7309:~/CEdev/examples/hello_world$ make
fatal error: error in backend: unable to legalize instruction: %918:_(s48) = G_LSHR %916:_, %919:_(s8) (in function: main)
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: /home/keagan/CEdev/bin/ez80-clang -S -mllvm -profile-guided-section-prefix=false -Wall -Wextra -O3 /home/keagan/CEdev/examples/hello_world/obj/lto.bc -o /home/keagan/CEdev/examples/hello_world/obj/lto.src
1. Code generation
2. Running pass 'Function Pass Manager' on module '/home/keagan/CEdev/examples/hello_world/obj/lto.bc'.
3. Running pass 'Legalizer' on function '@main'
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):
/home/keagan/CEdev/bin/ez80-clang(_ZN4llvm3sys15PrintStackTraceERNS_11raw_ostreamEi+0x23)[0x1770c83]
/home/keagan/CEdev/bin/ez80-clang(_ZN4llvm3sys17RunSignalHandlersEv+0xee)[0x176ebae]
/home/keagan/CEdev/bin/ez80-clang(_ZN4llvm3sys15CleanupOnSignalEm+0xdd)[0x17701ad]
/home/keagan/CEdev/bin/ez80-clang[0x16f428a]
/home/keagan/CEdev/bin/ez80-clang[0x16f422b]
/home/keagan/CEdev/bin/ez80-clang(_ZN4llvm3sys7Process4ExitEib+0x27)[0x176b027]
/home/keagan/CEdev/bin/ez80-clang[0x9baff2]
/home/keagan/CEdev/bin/ez80-clang(_ZN4llvm18report_fatal_errorERKNS_5TwineEb+0x128)[0x16f7f38]
/home/keagan/CEdev/bin/ez80-clang[0x23a7fb4]
/home/keagan/CEdev/bin/ez80-clang(_ZN4llvm18reportGISelFailureERNS_15MachineFunctionERKNS_16TargetPassConfigERNS_32MachineOptimizationRemarkEmitterEPKcNS_9StringRefERKNS_12MachineInstrE+0x2fd)[0x23a82dd]
/home/keagan/CEdev/bin/ez80-clang(_ZN4llvm9Legalizer20runOnMachineFunctionERNS_15MachineFunctionE+0x355)[0x2350335]
/home/keagan/CEdev/bin/ez80-clang(_ZN4llvm19MachineFunctionPass13runOnFunctionERNS_8FunctionE+0x10e)[0xd57c7e]
/home/keagan/CEdev/bin/ez80-clang(_ZN4llvm13FPPassManager13runOnFunctionERNS_8FunctionE+0x39d)[0x110e6fd]
/home/keagan/CEdev/bin/ez80-clang(_ZN4llvm13FPPassManager11runOnModuleERNS_6ModuleE+0x33)[0x1114373]
/home/keagan/CEdev/bin/ez80-clang(_ZN4llvm6legacy15PassManagerImpl3runERNS_6ModuleE+0x3cf)[0x110ed3f]
/home/keagan/CEdev/bin/ez80-clang(_ZN5clang17EmitBackendOutputERNS_17DiagnosticsEngineERKNS_19HeaderSearchOptionsERKNS_14CodeGenOptionsERKNS_13TargetOptionsERKNS_11LangOptionsEN4llvm9StringRefEPNSE_6ModuleENS_13BackendActionESt10unique_ptrINSE_17raw_pwrite_streamESt14default_deleteISK_EE+0x1bf4)[0x19fa3c4]
/home/keagan/CEdev/bin/ez80-clang(_ZN5clang13CodeGenAction13ExecuteActionEv+0x75e)[0x2621d6e]
/home/keagan/CEdev/bin/ez80-clang(_ZN5clang14FrontendAction7ExecuteEv+0x57)[0x2051a37]
/home/keagan/CEdev/bin/ez80-clang(_ZN5clang16CompilerInstance13ExecuteActionERNS_14FrontendActionE+0x346)[0x1fcb826]
/home/keagan/CEdev/bin/ez80-clang(_ZN5clang25ExecuteCompilerInvocationEPNS_16CompilerInstanceE+0x27b)[0x20f635b]
/home/keagan/CEdev/bin/ez80-clang(_Z8cc1_mainN4llvm8ArrayRefIPKcEES2_Pv+0xad8)[0x9baca8]
/home/keagan/CEdev/bin/ez80-clang[0x9b8ddb]
/home/keagan/CEdev/bin/ez80-clang[0x1e53232]
/home/keagan/CEdev/bin/ez80-clang(_ZN4llvm20CrashRecoveryContext9RunSafelyENS_12function_refIFvvEEE+0xdd)[0x16f420d]
/home/keagan/CEdev/bin/ez80-clang(_ZNK5clang6driver10CC1Command7ExecuteEN4llvm8ArrayRefINS2_8OptionalINS2_9StringRefEEEEEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPb+0x134)[0x1e52d64]
/home/keagan/CEdev/bin/ez80-clang(_ZNK5clang6driver11Compilation14ExecuteCommandERKNS0_7CommandERPS3_+0x1a4)[0x1e188c4]
/home/keagan/CEdev/bin/ez80-clang(_ZNK5clang6driver11Compilation11ExecuteJobsERKNS0_7JobListERN4llvm15SmallVectorImplISt4pairIiPKNS0_7CommandEEEE+0x77)[0x1e18d57]
/home/keagan/CEdev/bin/ez80-clang(_ZN5clang6driver6Driver18ExecuteCompilationERNS0_11CompilationERN4llvm15SmallVectorImplISt4pairIiPKNS0_7CommandEEEE+0x188)[0x1e354d8]
/home/keagan/CEdev/bin/ez80-clang(main+0x2737)[0x9b84e7]
/lib/x86_64-linux-gnu/libc.so.6(+0x29d90)[0x7f0db8d7dd90]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x80)[0x7f0db8d7de40]
/home/keagan/CEdev/bin/ez80-clang(_start+0x2e)[0x9b5ade]
ez80-clang: error: clang frontend command failed with exit code 70 (use -v to see invocation)
clang version 15.0.0 (https://github.com/jacobly0/llvm-project fcc1b7e50dd53a82c7aa1da469c572fbe23d2b54)
Target: ez80
Thread model: posix
InstalledDir: /home/keagan/CEdev/bin
ez80-clang: note: diagnostic msg: Error generating preprocessed source(s) - no preprocessable inputs.
make: *** [/home/keagan/CEdev/meta/makefile.mk:331: obj/lto.src] Error 1This started happening when I added a small, completely unrelated piece of code earlier today, I can point it out if needed. I tried on both latest normal release and nightly to no avail.
NOTE: Yes this is in the hello world example directory, I just started my project there and never bothered to move it.
Reactions are currently unavailable
Activity
mateoconlechuga commentedon Nov 23, 2023
Thanks! Will look into it.
mateoconlechuga commentedon Nov 23, 2023
Cannot reproduce with the latest nightly available here: https://github.com/CE-Programming/toolchain/releases/tag/nightly
mateoconlechuga commentedon Nov 23, 2023
Can repro now - maybe tell me that you decided to revert everything in your repo or provide a git hash next time please.
mateoconlechuga commentedon Nov 23, 2023
Opened an issue for the compiler: jacobly0/llvm-project#41
adriweb commentedon Nov 23, 2023
The nightly toolchain just wasn't pulling the "correct" compiler build (due to one of the CI thing failing (the old mac build can be fixed or removed @jacobly0 :P)
I can confirm the latest compiler works fine.
@Kasherpete try downloading the latest compiler build (ez80-clang) directly from the actions: https://github.com/jacobly0/llvm-project/actions/runs/6888394104
mateoconlechuga commentedon Nov 23, 2023
Reopening because this is a toolchain issue, not a compiler issue.
4 remaining items
Kasherpete commentedon Dec 4, 2023
Hey I just wanted to say that this worked, thank you so much!
adriweb commentedon Dec 4, 2023
well it's still not quite solved CI-wise (toolchain needs to get the latest binary of the compiler, which should probably be uploaded as a nightly release anyway)
Chandler-Kluser commentedon Feb 8, 2024
Actually I have built it from source and it is not solved
mateoconlechuga commentedon Feb 8, 2024
@Chandler-Kluser please stop posting in non-related issues. Open a new issue, no clue why you are building from source, read the getting started guide here: https://ce-programming.github.io/toolchain/static/getting-started.html
Your issue appears to be because you are not following any directions and hacking things together.
Chandler-Kluser commentedon Feb 8, 2024
I am building it from source because it is the most important part of FOSS, right?
If it cannot be compiled and everyone must use a release, you should think about maintaining a public repository
adriweb commentedon Feb 8, 2024
It can obviously be compiled, as the releases are built by the CI already, for convenience and transparency, as you can see in the GitHub Actions logs. Not sure what you're complaining about 🙄.
mateoconlechuga commentedon Feb 8, 2024
Build instructions are here. https://ce-programming.github.io/toolchain/static/contributing.html#building-the-ce-toolchain
mateoconlechuga commentedon Oct 7, 2024
Closing because I believe the toolchain now pulls in the correct compiler
Chandler-Kluser commentedon Oct 8, 2024
I am still getting the same error:
mateoconlechuga commentedon Oct 8, 2024
Not a toolchain issue, something is wrong with your configuration.
mateoconlechuga commentedon Oct 8, 2024
Additionally @Chandler-Kluser, open a new issue, you have hijacked this one with unrelated thing.