Issue 125975
Summary SIGILL when attempting to print result of an overloaded function
Labels new issue
Assignees
Reporter raiguard
    I have a reproducible crash when attempting to print a method call.

`lldb version 19.1.7`, Fedora Linux.

**My commands**
```
(lldb) file bin/Debugx64Clang/factorio-test
(lldb) b tests/TestFlip.cpp:256
(lldb) r -t FlipLinkedConnection
(lldb) p pump->getDirection()
```

**Source code**

Notes:

* `pump->getDirection()` is a heavily overloaded method which, in the case of a `Pump` entity, just returns `this->direction`.
* `TEST` and `CHECK_EQUAL` are macros.

```cpp
  TEST(FlipLinkedConnection)
  {
    TestScenario scenario;
    Pump* pump = scenario.addEntity("pump-with-linked-connection", MapPosition(0, 0.5));
 CHECK_EQUAL(pump->flip(Flip(true, false)), ActionResult::Success); // Breakpoint is on this line
    CHECK_EQUAL(pump->getDirection(), Direction::South);
    pump->setDirection(Direction::East);
 CHECK_EQUAL(pump->flip(Flip(false, true)), ActionResult::Success);
 CHECK_EQUAL(pump->getDirection(), Direction::West);
 }
```

**Backtrace**

The diagnostics folder contains one file - `diagnostics.log` - which is completely empty.

```
(lldb) print pump->getDirection()
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: lldb
1. HandleCommand(command = "print pump->getDirection()")
2.      <eof> parser at end of file
3.      <lldb wrapper prefix>:43:16: Generating code for declaration 'SuiteFlip::NullFixtureFlipLinkedConnectionHelper::$__lldb_expr'
 #0 0x00007f541d817b7a llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/lib64/libLLVM.so.19.1+0x217b7a)
 #1 0x00007f541d814b24 llvm::sys::RunSignalHandlers() (/lib64/libLLVM.so.19.1+0x214b24)
 #2 0x00007f541d8182eb (/lib64/libLLVM.so.19.1+0x2182eb)
 #3 0x00007f541d027050 __restore_rt (/lib64/libc.so.6+0x1a050)
 #4 0x00007f5418c5418c (/lib64/libclang-cpp.so.19.1+0xa5418c)
 #5 0x00007f5418c52bcd (/lib64/libclang-cpp.so.19.1+0xa52bcd)
 #6 0x00007f5418c51e4a (/lib64/libclang-cpp.so.19.1+0xa51e4a)
 #7 0x00007f5418c51e4a (/lib64/libclang-cpp.so.19.1+0xa51e4a)
 #8 0x00007f5418c51e4a (/lib64/libclang-cpp.so.19.1+0xa51e4a)
 #9 0x00007f5418c50980 (/lib64/libclang-cpp.so.19.1+0xa50980)
#10 0x00007f5418c4376f (/lib64/libclang-cpp.so.19.1+0xa4376f)
#11 0x00007f5418c42fd7 clang::ItaniumVTableContext::computeVTableRelatedInformation(clang::CXXRecordDecl const*) (/lib64/libclang-cpp.so.19.1+0xa42fd7)
#12 0x00007f5418c427b7 clang::ItaniumVTableContext::getMethodVTableIndex(clang::GlobalDecl) (/lib64/libclang-cpp.so.19.1+0xa427b7)
#13 0x00007f5419fce3aa (/lib64/libclang-cpp.so.19.1+0x1dce3aa)
#14 0x00007f5419c19e6b clang::CodeGen::CodeGenFunction::EmitCall(clang::CodeGen::CGFunctionInfo const&, clang::CodeGen::CGCallee const&, clang::CodeGen::ReturnValueSlot, clang::CodeGen::CallArgList const&, llvm::CallBase**, bool, clang::SourceLocation, bool) (/lib64/libclang-cpp.so.19.1+0x1a19e6b)
#15 0x00007f5419d1a69a clang::CodeGen::CodeGenFunction::EmitCXXMemberOrOperatorCall(clang::CXXMethodDecl const*, clang::CodeGen::CGCallee const&, clang::CodeGen::ReturnValueSlot, llvm::Value*, llvm::Value*, clang::QualType, clang::CallExpr const*, clang::CodeGen::CallArgList*) (/lib64/libclang-cpp.so.19.1+0x1b1a69a)
#16 0x00007f5419d1d94f clang::CodeGen::CodeGenFunction::EmitCXXMemberOrOperatorMemberCallExpr(clang::CallExpr const*, clang::CXXMethodDecl const*, clang::CodeGen::ReturnValueSlot, bool, clang::NestedNameSpecifier*, bool, clang::Expr const*) (/lib64/libclang-cpp.so.19.1+0x1b1d94f)
#17 0x00007f5419d1b6b8 clang::CodeGen::CodeGenFunction::EmitCXXMemberCallExpr(clang::CXXMemberCallExpr const*, clang::CodeGen::ReturnValueSlot) (/lib64/libclang-cpp.so.19.1+0x1b1b6b8)
#18 0x00007f5419d04265 clang::CodeGen::CodeGenFunction::EmitCallExpr(clang::CallExpr const*, clang::CodeGen::ReturnValueSlot) (/lib64/libclang-cpp.so.19.1+0x1b04265)
#19 0x00007f5419d19d18 (/lib64/libclang-cpp.so.19.1+0x1b19d18)
#20 0x00007f5419d15195 (/lib64/libclang-cpp.so.19.1+0x1b15195)
#21 0x00007f5419d10ddd (/lib64/libclang-cpp.so.19.1+0x1b10ddd)
#22 0x00007f5419d08dea (/lib64/libclang-cpp.so.19.1+0x1b08dea)
#23 0x00007f5419d08d29 clang::CodeGen::CodeGenFunction::EmitAggExpr(clang::Expr const*, clang::CodeGen::AggValueSlot) (/lib64/libclang-cpp.so.19.1+0x1b08d29)
#24 0x00007f5419d1e888 clang::CodeGen::CodeGenFunction::EmitCXXConstructExpr(clang::CXXConstructExpr const*, clang::CodeGen::AggValueSlot) (/lib64/libclang-cpp.so.19.1+0x1b1e888)
#25 0x00007f5419d1230e (/lib64/libclang-cpp.so.19.1+0x1b1230e)
#26 0x00007f5419d0fefe (/lib64/libclang-cpp.so.19.1+0x1b0fefe)
#27 0x00007f5419d08d29 clang::CodeGen::CodeGenFunction::EmitAggExpr(clang::Expr const*, clang::CodeGen::AggValueSlot) (/lib64/libclang-cpp.so.19.1+0x1b08d29)
#28 0x00007f5419cc801b clang::CodeGen::CodeGenFunction::EmitCXXGlobalVarDeclInit(clang::VarDecl const&, llvm::GlobalVariable*, bool) (/lib64/libclang-cpp.so.19.1+0x1ac801b)
#29 0x00007f5419fcfc9c (/lib64/libclang-cpp.so.19.1+0x1dcfc9c)
#30 0x00007f5419cb7a30 clang::CodeGen::CodeGenFunction::AddInitializerToStaticVarDecl(clang::VarDecl const&, llvm::GlobalVariable*) (/lib64/libclang-cpp.so.19.1+0x1ab7a30)
#31 0x00007f5419cb5df7 clang::CodeGen::CodeGenFunction::EmitStaticVarDecl(clang::VarDecl const&, llvm::GlobalValue::LinkageTypes) (/lib64/libclang-cpp.so.19.1+0x1ab5df7)
#32 0x00007f5419cb547d clang::CodeGen::CodeGenFunction::EmitDecl(clang::Decl const&) (/lib64/libclang-cpp.so.19.1+0x1ab547d)
#33 0x00007f5419e91a2b clang::CodeGen::CodeGenFunction::EmitSimpleStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) (/lib64/libclang-cpp.so.19.1+0x1c91a2b)
#34 0x00007f5419e90562 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) (/lib64/libclang-cpp.so.19.1+0x1c90562)
#35 0x00007f5419ea02bc clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) (/lib64/libclang-cpp.so.19.1+0x1ca02bc)
#36 0x00007f5419f12fcb clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) (/lib64/libclang-cpp.so.19.1+0x1d12fcb)
#37 0x00007f5419f3cd26 clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/lib64/libclang-cpp.so.19.1+0x1d3cd26)
#38 0x00007f5419f340e0 clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/lib64/libclang-cpp.so.19.1+0x1d340e0)
#39 0x00007f5419f39262 clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) (/lib64/libclang-cpp.so.19.1+0x1d39262)
#40 0x00007f5419f32c65 clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) (/lib64/libclang-cpp.so.19.1+0x1d32c65)
#41 0x00007f5419ff3c0c (/lib64/libclang-cpp.so.19.1+0x1df3c0c)
#42 0x00007f5425f36d20 (/lib64/liblldb.so.19.1+0xd36d20)
#43 0x00007f54183f54e6 clang::ParseAST(clang::Sema&, bool, bool) (/lib64/libclang-cpp.so.19.1+0x1f54e6)
#44 0x00007f5425f587d2 (/lib64/liblldb.so.19.1+0xd587d2)
#45 0x00007f5425f2bc57 (/lib64/liblldb.so.19.1+0xd2bc57)
#46 0x00007f5425f2c53b (/lib64/liblldb.so.19.1+0xd2c53b)
#47 0x00007f542568ffc4 (/lib64/liblldb.so.19.1+0x48ffc4)
#48 0x00007f542584b85e (/lib64/liblldb.so.19.1+0x64b85e)
#49 0x00007f5425df9f9e (/lib64/liblldb.so.19.1+0xbf9f9e)
#50 0x00007f54257012ba (/lib64/liblldb.so.19.1+0x5012ba)
#51 0x00007f54256ef0c5 (/lib64/liblldb.so.19.1+0x4ef0c5)
#52 0x00007f54256f5a28 (/lib64/liblldb.so.19.1+0x4f5a28)
#53 0x00007f54255ee641 (/lib64/liblldb.so.19.1+0x3ee641)
#54 0x00007f54255c170a (/lib64/liblldb.so.19.1+0x3c170a)
#55 0x00007f54256f8597 (/lib64/liblldb.so.19.1+0x4f8597)
#56 0x00007f542529f722 lldb::SBDebugger::RunCommandInterpreter(bool, bool) (/lib64/liblldb.so.19.1+0x9f722)
#57 0x000056428fe50853 (/usr/bin/lldb+0x4853)
#58 0x000056428fe52e5b (/usr/bin/lldb+0x6e5b)
#59 0x00007f541d010248 __libc_start_call_main (/lib64/libc.so.6+0x3248)
#60 0x00007f541d01030b __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x330b)
#61 0x000056428fe4e5d5 (/usr/bin/lldb+0x25d5)
LLDB diagnostics will be written to /tmp/diagnostics-4b7dc2
Please include the directory content when filing a bug report
The process was killed by SIGILL: Illegal instruction
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to