[llvm-bugs] [Bug 28623] New: segmentation fault on invalid code with "clang++ -std=c++11" on x86_64-linux-gnu

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jul 19 23:55:08 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=28623

            Bug ID: 28623
           Summary: segmentation fault on invalid code with "clang++
                    -std=c++11" on x86_64-linux-gnu
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: chengniansun at gmail.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
    Classification: Unclassified

$ clang++-trunk -std=c++11 small.C
small.C:5:22: error: reference to overloaded function could not be resolved;
did you mean to call it?
    __atomic_store_n(&store, i, m)
                     ^~~~~~
small.C:7:8: note: possible target for call
  void store(memory_order);
       ^
small.C:4:8: note: possible target for call
  void store(IntType i, memory_order m) {
       ^
#0 0x0000000001c6b8b5 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/local/clang-trunk/bin/clang-3.9+0x1c6b8b5)
#1 0x0000000001c69776 llvm::sys::RunSignalHandlers()
(/usr/local/clang-trunk/bin/clang-3.9+0x1c69776)
#2 0x0000000001c69994 SignalHandler(int)
(/usr/local/clang-trunk/bin/clang-3.9+0x1c69994)
#3 0x00007f07c073ded0 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10ed0)
#4 0x00000000028c9d4c
clang::Sema::SemaAtomicOpsOverloaded(clang::ActionResult<clang::Expr*, true>,
clang::AtomicExpr::AtomicOp) (/usr/local/clang-trunk/bin/clang-3.9+0x28c9d4c)
#5 0x00000000028cb071
clang::Sema::CheckBuiltinFunctionCall(clang::FunctionDecl*, unsigned int,
clang::CallExpr*) (/usr/local/clang-trunk/bin/clang-3.9+0x28cb071)
#6 0x0000000002a3374d clang::Sema::BuildResolvedCallExpr(clang::Expr*,
clang::NamedDecl*, clang::SourceLocation, llvm::ArrayRef<clang::Expr*>,
clang::SourceLocation, clang::Expr*, bool)
(/usr/local/clang-trunk/bin/clang-3.9+0x2a3374d)
#7 0x0000000002a34397 clang::Sema::ActOnCallExpr(clang::Scope*, clang::Expr*,
clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>,
clang::SourceLocation, clang::Expr*, bool)
(/usr/local/clang-trunk/bin/clang-3.9+0x2a34397)
#8 0x00000000026df3eb
clang::Parser::ParsePostfixExpressionSuffix(clang::ActionResult<clang::Expr*,
true>) (/usr/local/clang-trunk/bin/clang-3.9+0x26df3eb)
#9 0x00000000026da458 clang::Parser::ParseCastExpression(bool, bool, bool&,
clang::Parser::TypeCastState) (/usr/local/clang-trunk/bin/clang-3.9+0x26da458)
#10 0x00000000026dcd7d clang::Parser::ParseCastExpression(bool, bool,
clang::Parser::TypeCastState) (/usr/local/clang-trunk/bin/clang-3.9+0x26dcd7d)
#11 0x00000000026dce09
clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState)
(/usr/local/clang-trunk/bin/clang-3.9+0x26dce09)
#12 0x00000000026dce89
clang::Parser::ParseExpression(clang::Parser::TypeCastState)
(/usr/local/clang-trunk/bin/clang-3.9+0x26dce89)
#13 0x0000000002717e76 clang::Parser::ParseExprStatement()
(/usr/local/clang-trunk/bin/clang-3.9+0x2717e76)
#14 0x0000000002718997
clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::AllowedContsructsKind, clang::SourceLocation*,
clang::Parser::ParsedAttributesWithRange&)
(/usr/local/clang-trunk/bin/clang-3.9+0x2718997)
#15 0x0000000002718aee
clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::AllowedContsructsKind, clang::SourceLocation*)
(/usr/local/clang-trunk/bin/clang-3.9+0x2718aee)
#16 0x000000000271c4ff clang::Parser::ParseCompoundStatementBody(bool)
(/usr/local/clang-trunk/bin/clang-3.9+0x271c4ff)
#17 0x000000000271eac1 clang::Parser::ParseFunctionStatementBody(clang::Decl*,
clang::Parser::ParseScope&) (/usr/local/clang-trunk/bin/clang-3.9+0x271eac1)
#18 0x00000000026a6291
clang::Parser::ParseLexedMethodDef(clang::Parser::LexedMethod&)
(/usr/local/clang-trunk/bin/clang-3.9+0x26a6291)
#19 0x00000000026a600e
clang::Parser::ParseLexedMethodDefs(clang::Parser::ParsingClass&)
(/usr/local/clang-trunk/bin/clang-3.9+0x26a600e)
#20 0x00000000026d59b9
clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation,
clang::SourceLocation, clang::Parser::ParsedAttributesWithRange&, unsigned int,
clang::Decl*) (/usr/local/clang-trunk/bin/clang-3.9+0x26d59b9)
#21 0x00000000026d6699
clang::Parser::ParseClassSpecifier(clang::tok::TokenKind,
clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo
const&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext,
clang::Parser::ParsedAttributesWithRange&)
(/usr/local/clang-trunk/bin/clang-3.9+0x26d6699)
#22 0x00000000026b96f9
clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&,
clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier,
clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*)
(/usr/local/clang-trunk/bin/clang-3.9+0x26b96f9)
#23 0x000000000269eca4
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier)
(/usr/local/clang-trunk/bin/clang-3.9+0x269eca4)
#24 0x000000000269f3e1
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier) [clone .part.222]
(/usr/local/clang-trunk/bin/clang-3.9+0x269f3e1)
#25 0x000000000269f41f
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier)
(/usr/local/clang-trunk/bin/clang-3.9+0x269f41f)
#26 0x00000000026a1100
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) (/usr/local/clang-trunk/bin/clang-3.9+0x26a1100)
#27 0x00000000026a18b0
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&)
(/usr/local/clang-trunk/bin/clang-3.9+0x26a18b0)
#28 0x000000000269c16b clang::ParseAST(clang::Sema&, bool, bool)
(/usr/local/clang-trunk/bin/clang-3.9+0x269c16b)
#29 0x000000000236afbb clang::CodeGenAction::ExecuteAction()
(/usr/local/clang-trunk/bin/clang-3.9+0x236afbb)
#30 0x000000000209aa4e clang::FrontendAction::Execute()
(/usr/local/clang-trunk/bin/clang-3.9+0x209aa4e)
#31 0x0000000002071526
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/local/clang-trunk/bin/clang-3.9+0x2071526)
#32 0x0000000002123942
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/local/clang-trunk/bin/clang-3.9+0x2123942)
#33 0x0000000000b0eba8 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/local/clang-trunk/bin/clang-3.9+0xb0eba8)
#34 0x0000000000ac3325 main (/usr/local/clang-trunk/bin/clang-3.9+0xac3325)
#35 0x00007f07bf8f6730 __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x20730)
#36 0x0000000000b0ad04 _start (/usr/local/clang-trunk/bin/clang-3.9+0xb0ad04)
Stack dump:
0.    Program arguments: /usr/local/clang-trunk/bin/clang-3.9 -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name
small.C -mrelocation-model static -mthread-model posix -mdisable-fp-elim
-fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables
-fuse-init-array -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb
-resource-dir /usr/local/clang-trunk/bin/../lib/clang/3.9.0 -c-isystem .
-c-isystem /usr/local/include/csmith -internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/x86_64-linux-gnu/c++/5.4.0
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/x86_64-linux-gnu/c++/5.4.0
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/backward
-internal-isystem /usr/local/include -internal-isystem
/usr/local/clang-trunk/bin/../lib/clang/3.9.0/include -internal-externc-isystem
/usr/include/x86_64-linux-gnu -internal-externc-isystem /include
-internal-externc-isystem /usr/include -std=c++11 -fdeprecated-macro
-fdebug-compilation-dir
/home/cnsun/workspace/meta-compiler/error-fuzzer/temp-runs/IdentifierSubstituionFuzzingEngine/crash/20160619-clang++-trunk--O3-c-Weverything-std=c++14-build-070449
-ferror-limit 19 -fmessage-length 272 -fobjc-runtime=gcc -fcxx-exceptions
-fexceptions -fdiagnostics-show-option -fcolor-diagnostics -o
/tmp/small-ef05ef.o -x c++ small.C 
1.    small.C:5:34: current parser token ')'
2.    small.C:2:1: parsing struct/union/class body 'AtomicBase'
3.    small.C:4:41: parsing function body 'AtomicBase::store'
4.    small.C:4:41: in compound statement ('{}')
clang-3.9: error: unable to execute command: Segmentation fault
clang-3.9: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.9.0 (trunk 272938) (llvm/trunk 272936)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
clang-3.9: note: diagnostic msg: PLEASE submit a bug report to
http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and
associated run script.
clang-3.9: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-3.9: note: diagnostic msg: /tmp/small-699fee.cpp
clang-3.9: note: diagnostic msg: /tmp/small-699fee.sh
clang-3.9: note: diagnostic msg: 

********************
$ 
$ cat small.C
typedef enum {} memory_order;
struct AtomicBase {
  typedef int IntType;
  void store(IntType i, memory_order m) {
    __atomic_store_n(&store, i, m)
  }
  void store(memory_order);
};
$

-- 
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/20160720/08f1b847/attachment-0001.html>


More information about the llvm-bugs mailing list