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

clang with --debug and optimization cause assertion fault #5

Closed b-s-a closed 4 years ago

b-s-a commented 4 years ago

I try to run compiler with debug output enabled and optimization (-O1, but fault is caused by any value more than 0). Result: $ ./build/bin/clang --target=z80 --debug -S -O1 -xc -o- - <<< 'int func(int x, int y) { return x * y; }' clang-10: /home/bsa/projects/llvm-project/llvm/include/llvm/Support/LowLevelTypeImpl.h:141: unsigned int llvm::LLT::getScalarSizeInBits() const: Assertion `RawData != 0 && "Invalid Type"' failed. Stack dump:

  1. Program arguments: /home/bsa/projects/llvm-project/build/bin/clang-10 -cc1 -triple z80 -S -disable-free -main-file-name crc.c -mrelocation-model static -mthread-model posix -mframe-pointer=all -fmath-errno -no-integrated-as -mconstructor-aliases -dwarf-column-info -debug-info-kind=limited -dwarf-version=4 -debugger-tuning=gdb -resource-dir /home/bsa/projects/llvm-project/build/lib/clang/10.0.0 -O3 -fno-dwarf-directory-asm -fdebug-compilation-dir /home/bsa/projects/llvm-project -ferror-limit 19 -fmessage-length 0 -fgnuc-version=4.2.1 -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp -o crc.s -x c crc.c
  2. parser at end of file
  3. Code generation
  4. Running pass 'Function Pass Manager' on module 'crc.c'.
  5. Running pass 'RegBankSelect' on function '@sasComputeCrc' #9 0x00007fadbf4c7a0a llvm::LLT::getScalarSizeInBits() const /home/bsa/projects/llvm-project/llvm/include/llvm/Support/LowLevelTypeImpl.h:0:5 #10 0x00007fadbf4c2301 llvm::LLT::getSizeInBits() const /home/bsa/projects/llvm-project/llvm/include/llvm/Support/LowLevelTypeImpl.h:111:12 #11 0x00007fadbf513cc3 llvm::Z80GenRegisterBankInfo::getPartialMappingIdx(llvm::LLT const&) /home/bsa/projects/llvm-project/llvm/lib/Target/Z80/Z80RegisterBankInfo.cpp:64:3 #12 0x00007fadbf513e3e llvm::Z80RegisterBankInfo::getInstrPartialMappingIdxs(llvm::MachineInstr const&, llvm::MachineRegisterInfo const&, llvm::SmallVectorImpl&) /home/bsa/projects/llvm-project/llvm/lib/Target/Z80/Z80RegisterBankInfo.cpp:85:7 ...

clang itself was compiled by clang-8 (ubuntu amd64) with debug build type.

jacobly0 commented 4 years ago

Yes, debug info is not implemented at all.

jacobly0 commented 4 years ago

Passing -g stopped crashing a while ago and was effectively ignored, but now it actually outputs debug info so even though nothing exists yet to parse that output, this issue at least can be closed.