root-project / cling

The cling C++ interpreter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

div(1, 2).<TAB> will segmentation fault

Freed-Wu opened this issue · comments

commented
  • Checked for duplicates

Describe the bug

#include <stdlib.h>
div(1, 2)
div(1, 2).<TAB>
****************** CLING ******************
* Type C++ code and press enter to run it *
*             Type .q to exit             *
*******************************************
[cling]$ #include <stdlib.h>
[cling]$ div(1, 2)
(div_t) @0x555b0aefb890
[cling]$ div(1, 2). #0 0x0000555b05d9c95c llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/opt/cling/bin/cling+0xb3d95c)
 #1 0x0000555b05d9a834 llvm::sys::RunSignalHandlers() (/opt/cling/bin/cling+0xb3b834)
 #2 0x0000555b05d9a97b (/opt/cling/bin/cling+0xb3b97b)
 #3 0x00007f2e0e251f50 (/usr/lib/libc.so.6+0x38f50)
 #4 0x0000555b0713c0c3 clang::Sema::LookupSpecialMember(clang::CXXRecordDecl*, clang::Sema::CXXSpecialMember, bool, bool, bool, bool, bool) (/opt/cling/bin/cling+0x1edd0c3)
 #5 0x0000555b0713ca2b clang::Sema::LookupDestructor(clang::CXXRecordDecl*) (/opt/cling/bin/cling+0x1edda2b)
 #6 0x0000555b0706d78b clang::Sema::MaybeBindToTemporary(clang::Expr*) (/opt/cling/bin/cling+0x1e0e78b)
 #7 0x0000555b072062fb clang::Sema::BuildOverloadedCallExpr(clang::Scope*, clang::Expr*, clang::UnresolvedLookupExpr*, clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation, clang::Expr*, bool, bool) (/opt/cling/bin/cling+0x1fa72fb)
 #8 0x0000555b07034a34 clang::Sema::BuildCallExpr(clang::Scope*, clang::Expr*, clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation, clang::Expr*, bool) (/opt/cling/bin/cling+0x1dd5a34)
 #9 0x0000555b0703a135 clang::Sema::ActOnCallExpr(clang::Scope*, clang::Expr*, clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation, clang::Expr*) (/opt/cling/bin/cling+0x1ddb135)
#10 0x0000555b06cd05f9 clang::Parser::ParsePostfixExpressionSuffix(clang::ActionResult<clang::Expr*, true>) (/opt/cling/bin/cling+0x1a715f9)
#11 0x0000555b06cca33a clang::Parser::ParseCastExpression(bool, bool, bool&, clang::Parser::TypeCastState, bool) (/opt/cling/bin/cling+0x1a6b33a)
#12 0x0000555b06cccb16 clang::Parser::ParseCastExpression(bool, bool, clang::Parser::TypeCastState, bool) (/opt/cling/bin/cling+0x1a6db16)
#13 0x0000555b06ccee63 clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) (/opt/cling/bin/cling+0x1a6fe63)
#14 0x0000555b06ccfa6a clang::Parser::ParseExpression(clang::Parser::TypeCastState) (/opt/cling/bin/cling+0x1a70a6a)
#15 0x0000555b06d1fd0e clang::Parser::ParseExprStatement(clang::Parser::ParsedStmtContext) (/opt/cling/bin/cling+0x1ac0d0e)
#16 0x0000555b06d1ef69 clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) (/opt/cling/bin/cling+0x1abff69)
#17 0x0000555b06d22284 clang::Parser::ParseCompoundStatementBody(bool) (/opt/cling/bin/cling+0x1ac3284)
#18 0x0000555b06d24ebc clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) (/opt/cling/bin/cling+0x1ac5ebc)
#19 0x0000555b06d4435f clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) (/opt/cling/bin/cling+0x1ae535f)
#20 0x0000555b06ca9633 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::SourceLocation*, clang::Parser::ForRangeInit*) (/opt/cling/bin/cling+0x1a4a633)
#21 0x0000555b06d3df56 (/opt/cling/bin/cling+0x1adef56)
#22 0x0000555b06d45e32 clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec*) (/opt/cling/bin/cling+0x1ae6e32)
#23 0x0000555b06d47379 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, bool) (/opt/cling/bin/cling+0x1ae8379)
#24 0x0000555b05cdd421 cling::IncrementalParser::ParseInternal(llvm::StringRef) (/opt/cling/bin/cling+0xa7e421)
#25 0x0000555b05cde0cf cling::IncrementalParser::Compile(llvm::StringRef, cling::CompilationOptions const&) (/opt/cling/bin/cling+0xa7f0cf)
#26 0x0000555b05ce2c24 cling::Interpreter::CodeCompleteInternal(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, unsigned int) (/opt/cling/bin/cling+0xa83c24)
#27 0x0000555b05cea1ee cling::Interpreter::codeComplete(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, unsigned long&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>&) const (/opt/cling/bin/cling+0xa8b1ee)
#28 0x0000555b05dcd7d1 (/opt/cling/bin/cling+0xb6e7d1)
#29 0x0000555b05dd0d67 textinput::Editor::ProcessCommand(textinput::Editor::ECommandID, textinput::EditorRange&) (/opt/cling/bin/cling+0xb71d67)
#30 0x0000555b05ddabb4 textinput::TextInput::ProcessNewInput(textinput::InputData const&, textinput::EditorRange&) (/opt/cling/bin/cling+0xb7bbb4)
#31 0x0000555b05ddaf2b textinput::TextInput::ReadInput() (/opt/cling/bin/cling+0xb7bf2b)
#32 0x0000555b05dcdbfd cling::UserInterface::runInteractively(bool) (/opt/cling/bin/cling+0xb6ebfd)
#33 0x0000555b05bba63c main (/opt/cling/bin/cling+0x95b63c)
#34 0x00007f2e0e23c790 (/usr/lib/libc.so.6+0x23790)
#35 0x00007f2e0e23c84a __libc_start_main (/usr/lib/libc.so.6+0x2384a)
#36 0x0000555b05c1574e _start (/opt/cling/bin/cling+0x9b674e)
Stack dump:
0.      Program arguments: cling
1.      input_line_2:1:42: parsing function body '__cling_Un1Qu33'
2.      input_line_2:1:42: in compound statement ('{}')
zsh: segmentation fault (core dumped)  cling

Expected behavior

No error

To Reproduce

Setup

❯ cling --version
0.9
❯ uname -r
6.2.7-arch1-1

installed by pacman.

Additional context