Skip to content

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

Closed
@b-s-a

Description

@b-s-a

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:
0. 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

  1. parser at end of file
  2. Code generation
  3. Running pass 'Function Pass Manager' on module 'crc.c'.
  4. 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.

Metadata

Metadata

Assignees

Labels

crashSomething crashedenhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions