[llvm-bugs] [Bug 43256] New: clang++ segment fault with string_view and libstdc++
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Sep 9 06:24:28 PDT 2019
https://bugs.llvm.org/show_bug.cgi?id=43256
Bug ID: 43256
Summary: clang++ segment fault with string_view and libstdc++
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: C++17
Assignee: unassignedclangbugs at nondot.org
Reporter: yichen.yan at inf.ethz.ch
CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk
$ clang++ -std=c++17 --compile -o /dev/null 1.cc
clang-10: /home/yiyan/CLionProjects/llvm-trunk/clang/lib/AST/APValue.cpp:744:
bool clang::APValue::isNullPointer() const: Assertion `isLValue() && "Invalid
usage"' failed.
Stack dump:
0. Program arguments: /home/yiyan/.local/bin/clang-10 -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name
1.cc -mrelocation-model static -mthread-model posix -mframe-pointer=all
-fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables
-fuse-init-array -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb
-coverage-notes-file /dev/null.gcno -resource-dir
/home/yiyan/.local/lib/clang/10.0.0 -internal-isystem
/home/yiyan/.local/bin/../lib/gcc/x86_64-pc-linux-gnu/10.0.0/../../../../include/c++/10.0.0
-internal-isystem
/home/yiyan/.local/bin/../lib/gcc/x86_64-pc-linux-gnu/10.0.0/../../../../include/c++/10.0.0/x86_64-pc-linux-gnu
-internal-isystem
/home/yiyan/.local/bin/../lib/gcc/x86_64-pc-linux-gnu/10.0.0/../../../../include/c++/10.0.0/backward
-internal-isystem /usr/local/include -internal-isystem
/home/yiyan/.local/lib/clang/10.0.0/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 /home/yiyan/CLionProjects/stl_tooling -ferror-limit 19
-fmessage-length 0 -fobjc-runtime=gcc -fcxx-exceptions -fexceptions
-fdiagnostics-show-option -fcolor-diagnostics -faddrsig -o /dev/null -x c++
1.cc
1. 1.cc:9:1: current parser token '}'
2. 1.cc:3:15: parsing function body 'test01'
3. 1.cc:3:15: in compound statement ('{}')
#0 0x00000000039f6897 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
/home/yiyan/CLionProjects/llvm-trunk/llvm/lib/Support/Unix/Signals.inc:532:11
#1 0x00000000039f6a39 PrintStackTraceSignalHandler(void*)
/home/yiyan/CLionProjects/llvm-trunk/llvm/lib/Support/Unix/Signals.inc:593:1
#2 0x00000000039f542b llvm::sys::RunSignalHandlers()
/home/yiyan/CLionProjects/llvm-trunk/llvm/lib/Support/Signals.cpp:67:5
#3 0x00000000039f70a8 SignalHandler(int)
/home/yiyan/CLionProjects/llvm-trunk/llvm/lib/Support/Unix/Signals.inc:384:1
#4 0x00007f61297ae890 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)
#5 0x00007f612807de97 raise
/build/glibc-OTsEL5/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
#6 0x00007f612807f801 abort /build/glibc-OTsEL5/glibc-2.27/stdlib/abort.c:81:0
#7 0x00007f612806f39a __assert_fail_base
/build/glibc-OTsEL5/glibc-2.27/assert/assert.c:89:0
#8 0x00007f612806f412 (/lib/x86_64-linux-gnu/libc.so.6+0x30412)
#9 0x0000000007926d4c clang::APValue::isNullPointer() const
/home/yiyan/CLionProjects/llvm-trunk/clang/lib/AST/APValue.cpp:0:3
#10 0x0000000007d0e844 EvaluateArgs(llvm::ArrayRef<clang::Expr const*>,
llvm::SmallVector<clang::APValue, 8u>&, (anonymous namespace)::EvalInfo&,
clang::FunctionDecl const*)
/home/yiyan/CLionProjects/llvm-trunk/clang/lib/AST/ExprConstant.cpp:5129:44
#11 0x0000000007d0dced HandleFunctionCall(clang::SourceLocation,
clang::FunctionDecl const*, (anonymous namespace)::LValue const*,
llvm::ArrayRef<clang::Expr const*>, clang::Stmt const*, (anonymous
namespace)::EvalInfo&, clang::APValue&, (anonymous namespace)::LValue const*)
/home/yiyan/CLionProjects/llvm-trunk/clang/lib/AST/ExprConstant.cpp:5146:7
#12 0x0000000007d678cf (anonymous namespace)::ExprEvaluatorBase<(anonymous
namespace)::IntExprEvaluator>::handleCallExpr(clang::CallExpr const*,
clang::APValue&, (anonymous namespace)::LValue const*)
/home/yiyan/CLionProjects/llvm-trunk/clang/lib/AST/ExprConstant.cpp:6204:9
#13 0x0000000007d662d4 (anonymous namespace)::ExprEvaluatorBase<(anonymous
namespace)::IntExprEvaluator>::VisitCallExpr(clang::CallExpr const*)
/home/yiyan/CLionProjects/llvm-trunk/clang/lib/AST/ExprConstant.cpp:6078:9
#14 0x0000000007d3edd8 (anonymous
namespace)::IntExprEvaluator::VisitCallExpr(clang::CallExpr const*)
/home/yiyan/CLionProjects/llvm-trunk/clang/lib/AST/ExprConstant.cpp:9478:3
#15 0x0000000007d3ee43 clang::StmtVisitorBase<llvm::make_const_ptr, (anonymous
namespace)::IntExprEvaluator,
bool>::VisitCXXMemberCallExpr(clang::CXXMemberCallExpr const*)
/tmp/tmpeq5eck_z/tools/clang/include/clang/AST/StmtNodes.inc:775:1
#16 0x0000000007d3b5d3 clang::StmtVisitorBase<llvm::make_const_ptr, (anonymous
namespace)::IntExprEvaluator, bool>::Visit(clang::Stmt const*)
/tmp/tmpeq5eck_z/tools/clang/include/clang/AST/StmtNodes.inc:775:1
#17 0x0000000007d09400 Evaluate(clang::APValue&, (anonymous
namespace)::EvalInfo&, clang::Expr const*)
/home/yiyan/CLionProjects/llvm-trunk/clang/lib/AST/ExprConstant.cpp:12182:9
#18 0x0000000007d11980 (anonymous
namespace)::LValueExprEvaluator::VisitBinAssign(clang::BinaryOperator const*)
/home/yiyan/CLionProjects/llvm-trunk/clang/lib/AST/ExprConstant.cpp:6893:7
#19 0x0000000007d0fa12 clang::StmtVisitorBase<llvm::make_const_ptr, (anonymous
namespace)::LValueExprEvaluator, bool>::Visit(clang::Stmt const*)
/home/yiyan/CLionProjects/llvm-trunk/clang/include/clang/AST/StmtVisitor.h:71:26
#20 0x0000000007d08a0f EvaluateLValue(clang::Expr const*, (anonymous
namespace)::LValue&, (anonymous namespace)::EvalInfo&, bool)
/home/yiyan/CLionProjects/llvm-trunk/clang/lib/AST/ExprConstant.cpp:6592:3
#21 0x0000000007d09315 Evaluate(clang::APValue&, (anonymous
namespace)::EvalInfo&, clang::Expr const*)
/home/yiyan/CLionProjects/llvm-trunk/clang/lib/AST/ExprConstant.cpp:12175:9
#22 0x0000000007d0b006 EvaluateAsRValue((anonymous namespace)::EvalInfo&,
clang::Expr const*, clang::APValue&)
/home/yiyan/CLionProjects/llvm-trunk/clang/lib/AST/ExprConstant.cpp:12285:7
#23 0x0000000007d0b27f clang::Expr::EvaluateForOverflow(clang::ASTContext
const&) const
/home/yiyan/CLionProjects/llvm-trunk/clang/lib/AST/ExprConstant.cpp:12572:3
#24 0x0000000006a90497 clang::Sema::CheckForIntOverflow(clang::Expr*)
/home/yiyan/CLionProjects/llvm-trunk/clang/lib/Sema/SemaChecking.cpp:12096:7
#25 0x0000000006a908af clang::Sema::CheckCompletedExpr(clang::Expr*,
clang::SourceLocation, bool)
/home/yiyan/CLionProjects/llvm-trunk/clang/lib/Sema/SemaChecking.cpp:0:5
#26 0x0000000007036d38 clang::Sema::ActOnFinishFullExpr(clang::Expr*,
clang::SourceLocation, bool, bool)
/home/yiyan/CLionProjects/llvm-trunk/clang/lib/Sema/SemaExprCXX.cpp:7936:3
#27 0x00000000072f8392
clang::Sema::ActOnExprStmt(clang::ActionResult<clang::Expr*, true>, bool)
/home/yiyan/CLionProjects/llvm-trunk/clang/lib/Sema/SemaStmt.cpp:49:8
#28 0x000000000692cc9d
clang::Parser::handleExprStmt(clang::ActionResult<clang::Expr*, true>,
clang::Parser::ParsedStmtContext)
/home/yiyan/CLionProjects/llvm-trunk/clang/lib/Parse/ParseStmt.cpp:1003:18
#29 0x00000000069275e9
clang::Parser::ParseExprStatement(clang::Parser::ParsedStmtContext)
/home/yiyan/CLionProjects/llvm-trunk/clang/lib/Parse/ParseStmt.cpp:455:10
#30 0x0000000006926001
clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*,
clang::Parser::ParsedAttributesWithRange&)
/home/yiyan/CLionProjects/llvm-trunk/clang/lib/Parse/ParseStmt.cpp:231:12
#31 0x000000000692596d
clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*)
/home/yiyan/CLionProjects/llvm-trunk/clang/lib/Parse/ParseStmt.cpp:106:20
#32 0x000000000692d8e7 clang::Parser::ParseCompoundStatementBody(bool)
/home/yiyan/CLionProjects/llvm-trunk/clang/lib/Parse/ParseStmt.cpp:1077:11
#33 0x000000000692e74b clang::Parser::ParseFunctionStatementBody(clang::Decl*,
clang::Parser::ParseScope&)
/home/yiyan/CLionProjects/llvm-trunk/clang/lib/Parse/ParseStmt.cpp:2090:21
#34 0x00000000068587ee
clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&,
clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*)
/home/yiyan/CLionProjects/llvm-trunk/clang/lib/Parse/Parser.cpp:1326:3
#35 0x000000000687c441 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&,
clang::DeclaratorContext, clang::SourceLocation*, clang::Parser::ForRangeInit*)
/home/yiyan/CLionProjects/llvm-trunk/clang/lib/Parse/ParseDecl.cpp:2065:11
#36 0x000000000685770e
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier)
/home/yiyan/CLionProjects/llvm-trunk/clang/lib/Parse/Parser.cpp:1095:10
#37 0x0000000006856ce0
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier)
/home/yiyan/CLionProjects/llvm-trunk/clang/lib/Parse/Parser.cpp:1111:12
#38 0x00000000068565c0
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*)
/home/yiyan/CLionProjects/llvm-trunk/clang/lib/Parse/Parser.cpp:931:12
#39 0x000000000685489f
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, bool)
/home/yiyan/CLionProjects/llvm-trunk/clang/lib/Parse/Parser.cpp:682:12
#40 0x000000000684feb0 clang::ParseAST(clang::Sema&, bool, bool)
/home/yiyan/CLionProjects/llvm-trunk/clang/lib/Parse/ParseAST.cpp:158:16
#41 0x000000000457bfb2 clang::ASTFrontendAction::ExecuteAction()
/home/yiyan/CLionProjects/llvm-trunk/clang/lib/Frontend/FrontendAction.cpp:1044:1
#42 0x0000000004f5a9bb clang::CodeGenAction::ExecuteAction()
/home/yiyan/CLionProjects/llvm-trunk/clang/lib/CodeGen/CodeGenAction.cpp:1063:1
#43 0x000000000457b988 clang::FrontendAction::Execute()
/home/yiyan/CLionProjects/llvm-trunk/clang/lib/Frontend/FrontendAction.cpp:939:7
#44 0x000000000450e354
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
/home/yiyan/CLionProjects/llvm-trunk/clang/lib/Frontend/CompilerInstance.cpp:957:23
#45 0x00000000047065a7
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
/home/yiyan/CLionProjects/llvm-trunk/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:289:8
#46 0x0000000000c7d3cc cc1_main(llvm::ArrayRef<char const*>, char const*,
void*)
/home/yiyan/CLionProjects/llvm-trunk/clang/tools/driver/cc1_main.cpp:250:13
#47 0x0000000000c702ef ExecuteCC1Tool(llvm::ArrayRef<char const*>,
llvm::StringRef)
/home/yiyan/CLionProjects/llvm-trunk/clang/tools/driver/driver.cpp:309:5
#48 0x0000000000c6f689 main
/home/yiyan/CLionProjects/llvm-trunk/clang/tools/driver/driver.cpp:382:5
#49 0x00007f6128060b97 __libc_start_main
/build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:344:0
#50 0x0000000000c6ee7a _start (/home/yiyan/.local/bin/clang-10+0xc6ee7a)
clang-10: error: unable to execute command: Aborted
clang-10: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 10.0.0 (https://github.com/llvm/llvm-project.git
473d0d7f569c84446d9880727403524d4a9838eb)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/yiyan/.local/bin
clang-10: note: diagnostic msg: PLEASE submit a bug report to
https://bugs.llvm.org/ and include the crash backtrace, preprocessed source,
and associated run script.
clang-10: note: diagnostic msg:
********************
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-10: note: diagnostic msg: /tmp/1-ff4a30.cpp
clang-10: note: diagnostic msg: /tmp/1-ff4a30.sh
clang-10: note: diagnostic msg:
********************
original file starts:
#include <string_view>
void test01() {
typedef std::string_view::size_type t1;
t1 i1;
const char s1[] = "mave";
const std::string_view s2("mavericks, santa cruz");
i1 = s2.find(s1);
}
constexpr bool test02() {
const char s3[] = "mave";
std::string_view s4(s3);
return true;
}
int main() {
static_assert(test02());
}
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190909/3fa397b5/attachment.html>
More information about the llvm-bugs
mailing list