| Issue |
235744
|
| Summary |
[ClangIR] Assertion `offset >= size' failed.
|
| Labels |
crash-on-valid,
ClangIR,
generated by fuzzer
|
| Assignees |
|
| Reporter |
k-arrows
|
Reproducer:
https://godbolt.org/z/Psx4Tn7P8
```cpp
struct E {};
struct S {
unsigned a : 16;
unsigned b : 8;
E e;
} s;
```
Backtrace:
```console
clang++: /root/llvm-project/llvm/tools/clang/lib/CIR/CodeGen/CIRGenRecordLayoutBuilder.cpp:851: void {anonymous}::CIRRecordLowering::insertPadding(): Assertion `offset >= size' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and dumped files.
Stack dump:
0. Program arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/clang++ -g -o /app/output.s -mllvm --x86-asm-syntax=intel -fno-verbose-asm -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -Xclang -fclangir -fcolor-diagnostics -fno-crash-diagnostics <source>
1. <eof> parser at end of file
#0 0x0000000004eb0748 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4eb0748)
#1 0x0000000004ead9a4 llvm::sys::RunSignalHandlers() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4ead9a4)
#2 0x0000000004eadfdc llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4eadfdc)
#3 0x0000000004de74d8 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
#4 0x00007b8be5c45330 (/lib/x86_64-linux-gnu/libc.so.6+0x45330)
#5 0x00007b8be5c9ec0c pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x9ec0c)
#6 0x00007b8be5c4527e raise (/lib/x86_64-linux-gnu/libc.so.6+0x4527e)
#7 0x00007b8be5c288ff abort (/lib/x86_64-linux-gnu/libc.so.6+0x288ff)
#8 0x00007b8be5c2881b (/lib/x86_64-linux-gnu/libc.so.6+0x2881b)
#9 0x00007b8be5c3b517 (/lib/x86_64-linux-gnu/libc.so.6+0x3b517)
#10 0x00000000073f2716 (anonymous namespace)::CIRRecordLowering::lower(bool) CIRGenRecordLayoutBuilder.cpp:0:0
#11 0x00000000073f4b3b clang::CIRGen::CIRGenTypes::computeRecordLayout(clang::RecordDecl const*, cir::RecordType*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x73f4b3b)
#12 0x0000000007258467 clang::CIRGen::CIRGenTypes::convertRecordDeclType(clang::RecordDecl const*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7258467)
#13 0x0000000007258f7f clang::CIRGen::CIRGenTypes::getCIRGenRecordLayout(clang::RecordDecl const*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7258f7f)
#14 0x0000000007259259 clang::CIRGen::CIRGenTypes::isZeroInitializable(clang::QualType) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7259259)
#15 0x00000000073a20df clang::CIRGen::CIRGenModule::emitNullConstantAttr(clang::QualType) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x73a20df)
#16 0x00000000073aa1b1 clang::CIRGen::ConstantEmitter::tryEmitPrivateForVarInit(clang::VarDecl const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x73aa1b1)
#17 0x00000000073aa3a3 clang::CIRGen::ConstantEmitter::tryEmitForInitializer(clang::VarDecl const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x73aa3a3)
#18 0x00000000071e14f6 clang::CIRGen::CIRGenModule::emitGlobalVarDefinition(clang::VarDecl const*, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x71e14f6)
#19 0x00000000071e3259 clang::CIRGen::CIRGenModule::emitGlobalDefinition(clang::GlobalDecl, mlir::Operation*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x71e3259)
#20 0x00000000071e3885 clang::CIRGen::CIRGenModule::emitGlobal(clang::GlobalDecl) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x71e3885)
#21 0x00000000071e5897 clang::CIRGen::CIRGenModule::emitTopLevelDecl(clang::Decl*) (.part.0) CIRGenModule.cpp:0:0
#22 0x00000000071a9388 cir::CIRGenerator::HandleTopLevelDecl(clang::DeclGroupRef) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x71a9388)
#23 0x00000000060663ae cir::CIRGenConsumer::HandleTopLevelDecl(clang::DeclGroupRef) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x60663ae)
#24 0x0000000008ec6944 clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x8ec6944)
#25 0x0000000006069d18 cir::CIRGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6069d18)
#26 0x0000000005ccd7e8 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5ccd7e8)
#27 0x0000000005c5a5ed clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5c5a5ed)
#28 0x0000000005da3d23 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5da3d23)
#29 0x0000000001719538 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x1719538)
#30 0x000000000171041a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>) driver.cpp:0:0
#31 0x00000000017105a3 int llvm::function_ref<int (llvm::SmallVectorImpl<char const*>&)>::callback_fn<clang_main(int, char**, llvm::ToolContext const&)::'lambda'(llvm::SmallVectorImpl<char const*>&)>(long, llvm::SmallVectorImpl<char const*>&) driver.cpp:0:0
#32 0x0000000005a1cf69 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const::'lambda'()>(long) Job.cpp:0:0
#33 0x0000000004de78d4 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4de78d4)
#34 0x0000000005a1dad5 clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (.part.0) Job.cpp:0:0
#35 0x00000000059db112 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x59db112)
#36 0x00000000059de3cc clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x59de3cc)
#37 0x00000000059ea4d5 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x59ea4d5)
#38 0x0000000001715b6a clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x1715b6a)
#39 0x0000000001683673 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x1683673)
#40 0x00007b8be5c2a1ca (/lib/x86_64-linux-gnu/libc.so.6+0x2a1ca)
#41 0x00007b8be5c2a28b __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2a28b)
#42 0x000000000170fdc5 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x170fdc5)
clang++: error: clang frontend command failed due to signal (use -v to see invocation)
Program terminated with signal SIGABRT (6)
Compiler returned: 134
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs