-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Closed
Labels
clang:codegenIR generation bugs: mangling, exceptions, etc.IR generation bugs: mangling, exceptions, etc.confirmedVerified by a second partyVerified by a second partycrashPrefer [crash-on-valid] or [crash-on-invalid]Prefer [crash-on-valid] or [crash-on-invalid]
Description
https://godbolt.org/z/Wse93MM6d
struct A { int n; };
struct B { int n; };
struct C : A, B {};
void *f(C *c) {
return __builtin_assume_aligned((B*)c, 8);
}
extern "C" int printf(const char *, ...);
int main() {
C c;
printf("%p\n", f(&c));
return 0;
}
clang-17: /root/llvm-project/llvm/lib/IR/Instructions.cpp:1624: void llvm::StoreInst::AssertOK(): Assertion `cast<PointerType>(getOperand(1)->getType()) ->isOpaqueOrPointeeTypeMatches(getOperand(0)->getType()) && "Ptr must be a pointer to Val type!"' failed.
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: /opt/compiler-explorer/clang-assertions-trunk-20230522/bin/clang-17 -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -dumpdir /app/output.s- -disable-free -clear-ast-before-backend -main-file-name example.cpp -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debug-info-kind=constructor -dwarf-version=4 -debugger-tuning=gdb -fcoverage-compilation-dir=/app -resource-dir /opt/compiler-explorer/clang-assertions-trunk-20230522/lib/clang/17 -D FOO -internal-isystem /opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/14.0.0/../../../../include/c++/14.0.0 -internal-isystem /opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/14.0.0/../../../../include/c++/14.0.0/x86_64-linux-gnu -internal-isystem /opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/14.0.0/../../../../include/c++/14.0.0/backward -internal-isystem /opt/compiler-explorer/clang-assertions-trunk-20230522/lib/clang/17/include -internal-isystem /usr/local/include -internal-isystem /opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/14.0.0/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -std=c++17 -fdeprecated-macro -fdebug-compilation-dir=/app -ferror-limit 19 -fsanitize=alignment -fsanitize-recover=alignment -fno-sanitize-memory-param-retval -fno-sanitize-address-use-odr-indicator -fgnuc-version=4.2.1 -fcxx-exceptions -fexceptions -fcolor-diagnostics -no-opaque-pointers -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/example-076b96.o -x c++ <source>
1. <source>:9:1: current parser token 'extern'
2. <source>:5:7: LLVM IR generation of declaration 'f'
3. <source>:5:7: Generating code for declaration 'f'
#0 0x000055f17324d6ff llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk-20230522/bin/clang-17+0x3baa6ff)
#1 0x000055f17324ae54 SignalHandler(int) Signals.cpp:0:0
#2 0x00007fcea04b2420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
#3 0x00007fce9ff7f00b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
#4 0x00007fce9ff5e859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
#5 0x00007fce9ff5e729 (/lib/x86_64-linux-gnu/libc.so.6+0x22729)
#6 0x00007fce9ff6ffd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
#7 0x000055f172b6fff0 llvm::StoreInst::AssertOK() (/opt/compiler-explorer/clang-assertions-trunk-20230522/bin/clang-17+0x34ccff0)
#8 0x000055f172b701e7 llvm::StoreInst::StoreInst(llvm::Value*, llvm::Value*, bool, llvm::Align, llvm::Instruction*) (/opt/compiler-explorer/clang-assertions-trunk-20230522/bin/clang-17+0x34cd1e7)
#9 0x000055f173565def clang::CodeGen::CGBuilderTy::CreateStore(llvm::Value*, clang::CodeGen::Address, bool) (/opt/compiler-explorer/clang-assertions-trunk-20230522/bin/clang-17+0x3ec2def)
#10 0x000055f17356fdb8 clang::CodeGen::CodeGenFunction::EmitReturnStmt(clang::ReturnStmt const&) (/opt/compiler-explorer/clang-assertions-trunk-20230522/bin/clang-17+0x3eccdb8)
#11 0x000055f1735775ab clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) (/opt/compiler-explorer/clang-assertions-trunk-20230522/bin/clang-17+0x3ed45ab)
#12 0x000055f17357e044 clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) (/opt/compiler-explorer/clang-assertions-trunk-20230522/bin/clang-17+0x3edb044)
#13 0x000055f1735de00a clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::Stmt const*) (/opt/compiler-explorer/clang-assertions-trunk-20230522/bin/clang-17+0x3f3b00a)
#14 0x000055f1735f1dff clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) (/opt/compiler-explorer/clang-assertions-trunk-20230522/bin/clang-17+0x3f4edff)
#15 0x000055f1736521c9 clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/opt/compiler-explorer/clang-assertions-trunk-20230522/bin/clang-17+0x3faf1c9)
#16 0x000055f17364d155 clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/opt/compiler-explorer/clang-assertions-trunk-20230522/bin/clang-17+0x3faa155)
#17 0x000055f17364dd28 clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) (/opt/compiler-explorer/clang-assertions-trunk-20230522/bin/clang-17+0x3faad28)
#18 0x000055f173656c33 clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) (.part.0) CodeGenModule.cpp:0:0
#19 0x000055f174488de9 (anonymous namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef) ModuleBuilder.cpp:0:0
#20 0x000055f1744792c0 clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef) (/opt/compiler-explorer/clang-assertions-trunk-20230522/bin/clang-17+0x4dd62c0)
#21 0x000055f17597ef84 clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk-20230522/bin/clang-17+0x62dbf84)
#22 0x000055f174485b58 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk-20230522/bin/clang-17+0x4de2b58)
#23 0x000055f173ce1049 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk-20230522/bin/clang-17+0x463e049)
#24 0x000055f173c65ef6 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk-20230522/bin/clang-17+0x45c2ef6)
#25 0x000055f173dc3a96 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk-20230522/bin/clang-17+0x4720a96)
#26 0x000055f170726dfc cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk-20230522/bin/clang-17+0x1083dfc)
#27 0x000055f170722b1a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#28 0x000055f1707240fc clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk-20230522/bin/clang-17+0x10810fc)
#29 0x000055f17062c2a5 main (/opt/compiler-explorer/clang-assertions-trunk-20230522/bin/clang-17+0xf892a5)
#30 0x00007fce9ff60083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#31 0x000055f17071d8fe _start (/opt/compiler-explorer/clang-assertions-trunk-20230522/bin/clang-17+0x107a8fe)
clang++: error: unable to execute command: Aborted (core dumped)
clang++: error: clang frontend command failed due to signal (use -v to see invocation)
x86-64 clang (assertions trunk) - 1707ms
LLVM IR Viewer x86-64 clang (assertio
Metadata
Metadata
Assignees
Labels
clang:codegenIR generation bugs: mangling, exceptions, etc.IR generation bugs: mangling, exceptions, etc.confirmedVerified by a second partyVerified by a second partycrashPrefer [crash-on-valid] or [crash-on-invalid]Prefer [crash-on-valid] or [crash-on-invalid]