Skip to content

Segmentation fault on invalid code on x86_64-linux-gnu with "-std=c++11" #28679

@chengniansun

Description

@chengniansun
Bugzilla Link 28305
Version trunk
OS Windows NT

Extended Description

$: clang++-trunk -v
clang version 3.9.0 (trunk 272938) (llvm/trunk 272936)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8.4
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9.2
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.2
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@MX32
Selected multilib: .;@m64
$:
$: clang++-trunk -std=c++11 small.C
small.C:3:5: error: function cannot return function type 'decltype(abort)' (aka 'void ()')
->decltype (abort) {
^
#​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 0x00007f362d18d8d0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0xf8d0)
#​4 0x00000000028c6a90 clang::Sema::CheckParmsForFunctionDef(clang::ParmVarDecl* const*, clang::ParmVarDecl* const*, bool) (/usr/local/clang-trunk/bin/clang-3.9+0x28c6a90)
#​5 0x0000000002ada78c clang::Sema::startLambdaDefinition(clang::CXXRecordDecl*, clang::SourceRange, clang::TypeSourceInfo*, clang::SourceLocation, llvm::ArrayRefclang::ParmVarDecl*, bool) (/usr/local/clang-trunk/bin/clang-3.9+0x2ada78c)
#​6 0x0000000002c4bfd9 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformLambdaExpr(clang::LambdaExpr*) (/usr/local/clang-trunk/bin/clang-3.9+0x2c4bfd9)
#​7 0x0000000002c4d7d4 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformExpr(clang::Expr*) (/usr/local/clang-trunk/bin/clang-3.9+0x2c4d7d4)
#​8 0x0000000002c5fed9 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformStmt(clang::Stmt*) (/usr/local/clang-trunk/bin/clang-3.9+0x2c5fed9)
#​9 0x0000000002c60bdc clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformCompoundStmt(clang::CompoundStmt*, bool) (/usr/local/clang-trunk/bin/clang-3.9+0x2c60bdc)
#​10 0x0000000002c60ceb clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformCompoundStmt(clang::CompoundStmt*) (/usr/local/clang-trunk/bin/clang-3.9+0x2c60ceb)
#​11 0x0000000002c5ff63 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformStmt(clang::Stmt*) (/usr/local/clang-trunk/bin/clang-3.9+0x2c5ff63)
#​12 0x0000000002c64048 clang::Sema::SubstStmt(clang::Stmt*, clang::MultiLevelTemplateArgumentList const&) (/usr/local/clang-trunk/bin/clang-3.9+0x2c64048)
#​13 0x0000000002c867fc clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation, clang::FunctionDecl*, bool, bool, bool) (/usr/local/clang-trunk/bin/clang-3.9+0x2c867fc)
#​14 0x0000000002c85017 clang::Sema::PerformPendingInstantiations(bool) (/usr/local/clang-trunk/bin/clang-3.9+0x2c85017)
#​15 0x000000000288c50f clang::Sema::ActOnEndOfTranslationUnit() (/usr/local/clang-trunk/bin/clang-3.9+0x288c50f)
#​16 0x00000000026a1961 clang::Parser::ParseTopLevelDecl(clang::OpaquePtrclang::DeclGroupRef&) (/usr/local/clang-trunk/bin/clang-3.9+0x26a1961)
#​17 0x000000000269c16b clang::ParseAST(clang::Sema&, bool, bool) (/usr/local/clang-trunk/bin/clang-3.9+0x269c16b)
#​18 0x000000000236afbb clang::CodeGenAction::ExecuteAction() (/usr/local/clang-trunk/bin/clang-3.9+0x236afbb)
#​19 0x000000000209aa4e clang::FrontendAction::Execute() (/usr/local/clang-trunk/bin/clang-3.9+0x209aa4e)
#​20 0x0000000002071526 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/usr/local/clang-trunk/bin/clang-3.9+0x2071526)
#​21 0x0000000002123942 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/usr/local/clang-trunk/bin/clang-3.9+0x2123942)
#​22 0x0000000000b0eba8 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/usr/local/clang-trunk/bin/clang-3.9+0xb0eba8)
#​23 0x0000000000ac3325 main (/usr/local/clang-trunk/bin/clang-3.9+0xac3325)
#​24 0x00007f362c3b7b45 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b45)
#​25 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/4.9/../../../../include/c++/4.9 -internal-isystem /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9/../../../../include/x86_64-linux-gnu/c++/4.9 -internal-isystem /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9/../../../../include/x86_64-linux-gnu/c++/4.9 -internal-isystem /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9/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/20160621-clang++-trunk--O3-c-Weverything-std=c++14-build-051707 -ferror-limit 19 -fmessage-length 132 -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -o /tmp/small-366559.o -x c++ small.C

  1. parser at end of file
  2. small.C:2:27: instantiating function definition 'f'
    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-724233.cpp
clang-3.9: note: diagnostic msg: /tmp/small-724233.sh
clang-3.9: note: diagnostic msg:


$:
$: cat small.C

void abort ();
template < class T > void f (T) {
  [](int)->decltype (abort) {
  };
}

int main () {
  f (5);
  return 0;
}

$:

Metadata

Metadata

Assignees

Labels

bugzillaIssues migrated from bugzillaclang:frontendLanguage frontend issues, e.g. anything involving "Sema"confirmedVerified by a second partycrash-on-invalid

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions