Skip to content

Compiler Backend Fatal Issues #463

Closed

Description

@Kasherpete

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 1

This 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.

Activity

  1. mateoconlechuga commented on Nov 23, 2023

    @mateoconlechuga
    Collaborator

    Thanks! Will look into it.

  2. mateoconlechuga commented on Nov 23, 2023

    @mateoconlechuga
    Collaborator

    Cannot reproduce with the latest nightly available here: https://github.com/CE-Programming/toolchain/releases/tag/nightly

  3. mateoconlechuga commented on Nov 23, 2023

    @mateoconlechuga
    Collaborator

    Can repro now - maybe tell me that you decided to revert everything in your repo or provide a git hash next time please.

  4. mateoconlechuga commented on Nov 23, 2023

    @mateoconlechuga
    Collaborator

    Opened an issue for the compiler: jacobly0/llvm-project#41

  5. adriweb commented on Nov 23, 2023

    @adriweb
    Member

    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

  6. mateoconlechuga commented on Nov 23, 2023

    @mateoconlechuga
    Collaborator

    Reopening because this is a toolchain issue, not a compiler issue.

  7. 4 remaining items

  8. Kasherpete commented on Dec 4, 2023

    @Kasherpete
    Author

    Hey I just wanted to say that this worked, thank you so much!

  9. adriweb commented on Dec 4, 2023

    @adriweb
    Member

    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)

  10. Chandler-Kluser commented on Feb 8, 2024

    @Chandler-Kluser

    Actually I have built it from source and it is not solved

    /home/chandler/CEDev/examples $ make
    make -C hello_world/ 
    make[1]: Entrando no diretório '/home/chandler/CEDev/examples/hello_world'
    
    /home/chandler/CEDev/examples/hello_world/obj/lto.bc:1:2: error: expected top-level entity
            section .text,"ax",@progbits
            ^
    1 error generated.
    make[1]: *** [/home/chandler/CEDev/meta/makefile.mk:331: obj/lto.src] Error 1
    make[1]: Saindo do diretório '/home/chandler/CEDev/examples/hello_world'
    
    make: *** [makefile:10: hello_world/makefile] Error 2
  11. mateoconlechuga commented on Feb 8, 2024

    @mateoconlechuga
    Collaborator

    @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.

  12. Chandler-Kluser commented on Feb 8, 2024

    @Chandler-Kluser

    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

  13. adriweb commented on Feb 8, 2024

    @adriweb
    Member

    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 🙄.

  14. mateoconlechuga commented on Feb 8, 2024

    @mateoconlechuga
    Collaborator
  15. mateoconlechuga commented on Oct 7, 2024

    @mateoconlechuga
    Collaborator

    Closing because I believe the toolchain now pulls in the correct compiler

  16. Chandler-Kluser commented on Oct 8, 2024

    @Chandler-Kluser

    Actually I have built it from source and it is not solved

    /home/chandler/CEDev/examples $ make
    make -C hello_world/ 
    make[1]: Entrando no diretório '/home/chandler/CEDev/examples/hello_world'
    
    /home/chandler/CEDev/examples/hello_world/obj/lto.bc:1:2: error: expected top-level entity
            section .text,"ax",@progbits
            ^
    1 error generated.
    make[1]: *** [/home/chandler/CEDev/meta/makefile.mk:331: obj/lto.src] Error 1
    make[1]: Saindo do diretório '/home/chandler/CEDev/examples/hello_world'
    
    make: *** [makefile:10: hello_world/makefile] Error 2

    I am still getting the same error:

    /home/chandler/toolchain/examples $ make
    make -C hello_world/ 
    make[1]: Entering directory '/home/chandler/SSD2/repositories/toolchain/examples/hello_world'
    [lto opt] obj/lto.bc
    /home/chandler/SSD2/repositories/toolchain/examples/hello_world/obj/lto.bc:1:2: error: expected top-level entity
            section .text,"ax",@progbits
            ^
    1 error generated.
    make[1]: *** [/home/chandler/CEDev/meta/makefile.mk:331: obj/lto.src] Error 1
    make[1]: Leaving directory '/home/chandler/SSD2/repositories/toolchain/examples/hello_world'
    make: *** [makefile:10: hello_world/makefile] Error 2
    
    ls -l /home/chandler/CEDev/bin/
    total 1348
    -rwxr-xr-x 1 chandler chandler 866424 Feb 10  2024 cedev-config
    -rwxr-xr-x 1 chandler chandler  40296 Feb 10  2024 convbin
    -rwxr-xr-x 1 chandler chandler  61696 Feb 10  2024 convfont
    -rwxr-xr-x 1 chandler chandler 392264 Feb 10  2024 convimg
    lrwxrwxrwx 1 chandler chandler     61 Oct  8 15:30 ez80-clang -> /home/chandler/llvm-project/build/bin/clang
    lrwxrwxrwx 1 chandler chandler     59 Oct  8 15:37 ez80-link -> /home/chandler/llvm-project/build/bin/llc
    lrwxrwxrwx 1 chandler chandler     46 Feb  7  2024 fasmg -> /home/chandler/Documentos/fasmg/core/fasmg.x64
    
    $ ez80-clang --version
    clang version 15.0.0 (https://github.com/jacobly0/llvm-project.git 005a99ce2569373524bd881207aa4a1e98a2b238)
    Target: ez80
    Thread model: posix
    InstalledDir: /usr/bin
    
  17. mateoconlechuga commented on Oct 8, 2024

    @mateoconlechuga
    Collaborator

    Not a toolchain issue, something is wrong with your configuration.

  18. mateoconlechuga commented on Oct 8, 2024

    @mateoconlechuga
    Collaborator

    Additionally @Chandler-Kluser, open a new issue, you have hijacked this one with unrelated thing.

  19. locked as off topic and limited conversation to collaborators on Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions