jacobly0 / llvm-project

This fork of the canonical git mirror of the LLVM subversion repository adds (e)Z80 targets. Please refer to the wiki for important build instructions.
https://github.com/jacobly0/llvm-project/wiki
123 stars 15 forks source link

Compiler crash with large stack frames #39

Open mateoconlechuga opened 1 year ago

mateoconlechuga commented 1 year ago

memory.c

struct m
{
    char a[150];
    char *b;
};

char a(struct m a, unsigned p)
{
    return a.b[p - 150];
}

compiler crash:

fatal error: error in backend: Error while trying to spill UBC from class O24: Cannot scavenge register without an emergency spill slot!
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/hew/CEdev/bin/ez80-clang -S -MD -nostdinc -isystem /home/hew/CEdev/include -Isrc -fno-threadsafe-statics -Xclang -fforce-mangle-main-argc-argv -mllvm -profile-guided-section-prefix=false -DNDEBUG -g0 -Wall -Wextra -Oz src/memory.c -o obj/src/memory.c.src
1.  <eof> parser at end of file
2.  Code generation
3.  Running pass 'Function Pass Manager' on module 'src/memory.c'.
4.  Running pass 'Prologue/Epilogue Insertion & Frame Finalization' on function '@a'
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/hew/CEdev/bin/ez80-clang(_ZN4llvm3sys15PrintStackTraceERNS_11raw_ostreamEi+0x23)[0x1770c83]
/home/hew/CEdev/bin/ez80-clang(_ZN4llvm3sys17RunSignalHandlersEv+0xee)[0x176ebae]
/home/hew/CEdev/bin/ez80-clang(_ZN4llvm3sys15CleanupOnSignalEm+0xdd)[0x17701ad]
/home/hew/CEdev/bin/ez80-clang[0x16f428a]
/home/hew/CEdev/bin/ez80-clang[0x16f422b]
/home/hew/CEdev/bin/ez80-clang(_ZN4llvm3sys7Process4ExitEib+0x27)[0x176b027]
/home/hew/CEdev/bin/ez80-clang[0x9baff2]
/home/hew/CEdev/bin/ez80-clang(_ZN4llvm18report_fatal_errorERKNS_5TwineEb+0x128)[0x16f7f38]
/home/hew/CEdev/bin/ez80-clang[0xea32bc]
/home/hew/CEdev/bin/ez80-clang(_ZN4llvm12RegScavenger16scavengeRegisterEPKNS_19TargetRegisterClassENS_26MachineInstrBundleIteratorINS_12MachineInstrELb0EEEib+0x870)[0xea3b30]
/home/hew/CEdev/bin/ez80-clang[0x9d8a4d]
/home/hew/CEdev/bin/ez80-clang[0x9e4728]
/home/hew/CEdev/bin/ez80-clang[0xe624be]
/home/hew/CEdev/bin/ez80-clang[0xe60cd9]
/home/hew/CEdev/bin/ez80-clang(_ZN4llvm19MachineFunctionPass13runOnFunctionERNS_8FunctionE+0x10e)[0xd57c7e]
/home/hew/CEdev/bin/ez80-clang(_ZN4llvm13FPPassManager13runOnFunctionERNS_8FunctionE+0x39d)[0x110e6fd]
/home/hew/CEdev/bin/ez80-clang(_ZN4llvm13FPPassManager11runOnModuleERNS_6ModuleE+0x33)[0x1114373]
/home/hew/CEdev/bin/ez80-clang(_ZN4llvm6legacy15PassManagerImpl3runERNS_6ModuleE+0x3cf)[0x110ed3f]
/home/hew/CEdev/bin/ez80-clang(_ZN5clang17EmitBackendOutputERNS_17DiagnosticsEngineERKNS_19HeaderSearchOptionsERKNS_14CodeGenOptionsERKNS_13TargetOptionsERKNS_11LangOptionsEN4llvm9StringRefEPNSE_6ModuleENS_13BackendActionESt10unique_ptrINSE_17raw_pwrite_streamESt14default_deleteISK_EE+0x1bf4)[0x19fa3c4]
/home/hew/CEdev/bin/ez80-clang[0x26231f8]
/home/hew/CEdev/bin/ez80-clang(_ZN5clang8ParseASTERNS_4SemaEbb+0x2a3)[0x30091e3]
/home/hew/CEdev/bin/ez80-clang(_ZN5clang14FrontendAction7ExecuteEv+0x57)[0x2051a37]
/home/hew/CEdev/bin/ez80-clang(_ZN5clang16CompilerInstance13ExecuteActionERNS_14FrontendActionE+0x346)[0x1fcb826]
/home/hew/CEdev/bin/ez80-clang(_ZN5clang25ExecuteCompilerInvocationEPNS_16CompilerInstanceE+0x27b)[0x20f635b]
/home/hew/CEdev/bin/ez80-clang(_Z8cc1_mainN4llvm8ArrayRefIPKcEES2_Pv+0xad8)[0x9baca8]
/home/hew/CEdev/bin/ez80-clang[0x9b8ddb]
/home/hew/CEdev/bin/ez80-clang[0x1e53232]
/home/hew/CEdev/bin/ez80-clang(_ZN4llvm20CrashRecoveryContext9RunSafelyENS_12function_refIFvvEEE+0xdd)[0x16f420d]
/home/hew/CEdev/bin/ez80-clang(_ZNK5clang6driver10CC1Command7ExecuteEN4llvm8ArrayRefINS2_8OptionalINS2_9StringRefEEEEEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPb+0x134)[0x1e52d64]
/home/hew/CEdev/bin/ez80-clang(_ZNK5clang6driver11Compilation14ExecuteCommandERKNS0_7CommandERPS3_+0x1a4)[0x1e188c4]
/home/hew/CEdev/bin/ez80-clang(_ZNK5clang6driver11Compilation11ExecuteJobsERKNS0_7JobListERN4llvm15SmallVectorImplISt4pairIiPKNS0_7CommandEEEE+0x77)[0x1e18d57]
/home/hew/CEdev/bin/ez80-clang(_ZN5clang6driver6Driver18ExecuteCompilationERNS0_11CompilationERN4llvm15SmallVectorImplISt4pairIiPKNS0_7CommandEEEE+0x188)[0x1e354d8]
/home/hew/CEdev/bin/ez80-clang(main+0x2737)[0x9b84e7]
/lib/x86_64-linux-gnu/libc.so.6(+0x29d90)[0x7fd5f8e29d90]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x80)[0x7fd5f8e29e40]
/home/hew/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

the compiler should not crash :)