[llvm-bugs] [Bug 28501] New: crash in PrintStackTrace when compiling a lambda returning an unknown type

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jul 11 08:46:50 PDT 2016


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

            Bug ID: 28501
           Summary: crash in PrintStackTrace when compiling a lambda
                    returning an unknown type
           Product: clang
           Version: 3.8
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: blastrock at free.fr
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

This simple program should not compile, but it makes the compiler crash:

auto l = [] {
  return NoType{};
  return NoType{};
};

Compile with

clang++ -std=c++14 tsts.cpp -c

Here is the output on clang 3.8:

tsts.cpp:2:10: error: use of undeclared identifier 'NoType'
  return NoType{};
         ^
#0 0x0000000000e65978 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/home/philippe/.local/bin/clang-3.8+0xe65978)
#1 0x0000000000e643c6 llvm::sys::RunSignalHandlers()
(/home/philippe/.local/bin/clang-3.8+0xe643c6)
#2 0x0000000000e66415 SignalHandler(int)
(/home/philippe/.local/bin/clang-3.8+0xe66415)
#3 0x00007f59e3ffbd40 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10d40)
#4 0x0000000001fc5017
clang::ASTContext::getCanonicalFunctionResultType(clang::QualType) const
(/home/philippe/.local/bin/clang-3.8+0x1fc5017)
#5 0x0000000001caf49f
clang::Sema::DeduceFunctionTypeFromReturnExpr(clang::FunctionDecl*,
clang::SourceLocation, clang::Expr*&, clang::AutoType*)
(/home/philippe/.local/bin/clang-3.8+0x1caf49f)
#6 0x0000000001cae9bb
clang::Sema::ActOnCapScopeReturnStmt(clang::SourceLocation, clang::Expr*)
(/home/philippe/.local/bin/clang-3.8+0x1cae9bb)
#7 0x0000000001cb0115 clang::Sema::ActOnReturnStmt(clang::SourceLocation,
clang::Expr*, clang::Scope*) (/home/philippe/.local/bin/clang-3.8+0x1cb0115)
#8 0x0000000001839126 clang::Parser::ParseReturnStatement()
(/home/philippe/.local/bin/clang-3.8+0x1839126)
#9 0x0000000001834961
clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::AllowedContsructsKind, clang::SourceLocation*,
clang::Parser::ParsedAttributesWithRange&)
(/home/philippe/.local/bin/clang-3.8+0x1834961)
#10 0x0000000001833c11
clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::AllowedContsructsKind, clang::SourceLocation*)
(/home/philippe/.local/bin/clang-3.8+0x1833c11)
#11 0x000000000183a984 clang::Parser::ParseCompoundStatementBody(bool)
(/home/philippe/.local/bin/clang-3.8+0x183a984)
#12 0x000000000180eac4
clang::Parser::ParseLambdaExpressionAfterIntroducer(clang::LambdaIntroducer&)
(/home/philippe/.local/bin/clang-3.8+0x180eac4)
#13 0x000000000180ce7a clang::Parser::ParseLambdaExpression()
(/home/philippe/.local/bin/clang-3.8+0x180ce7a)
#14 0x00000000017fdf57 clang::Parser::ParseCastExpression(bool, bool, bool&,
clang::Parser::TypeCastState) (/home/philippe/.local/bin/clang-3.8+0x17fdf57)
#15 0x00000000017fa2ac
clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState)
(/home/philippe/.local/bin/clang-3.8+0x17fa2ac)
#16 0x00000000017d8aad
clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&,
clang::Parser::ParsedTemplateInfo const&, clang::Parser::ForRangeInit*)
(/home/philippe/.local/bin/clang-3.8+0x17d8aad)
#17 0x00000000017d6689 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&,
unsigned int, clang::SourceLocation*, clang::Parser::ForRangeInit*)
(/home/philippe/.local/bin/clang-3.8+0x17d6689)
#18 0x00000000017c143d
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier)
(/home/philippe/.local/bin/clang-3.8+0x17c143d)
#19 0x00000000017c0e28
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier)
(/home/philippe/.local/bin/clang-3.8+0x17c0e28)
#20 0x00000000017c03cf
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) (/home/philippe/.local/bin/clang-3.8+0x17c03cf)
#21 0x00000000017bf655
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&)
(/home/philippe/.local/bin/clang-3.8+0x17bf655)
#22 0x00000000017bc011 clang::ParseAST(clang::Sema&, bool, bool)
(/home/philippe/.local/bin/clang-3.8+0x17bc011)
#23 0x00000000012309dc clang::FrontendAction::Execute()
(/home/philippe/.local/bin/clang-3.8+0x12309dc)
#24 0x0000000001200828
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/home/philippe/.local/bin/clang-3.8+0x1200828)
#25 0x00000000012a0d9d
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/home/philippe/.local/bin/clang-3.8+0x12a0d9d)
#26 0x00000000006ab29a cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/home/philippe/.local/bin/clang-3.8+0x6ab29a)
#27 0x00000000006aa530 main (/home/philippe/.local/bin/clang-3.8+0x6aa530)
#28 0x00007f59e31b85f0 __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x205f0)
#29 0x00000000006a7669 _start (/home/philippe/.local/bin/clang-3.8+0x6a7669)
Stack dump:
0.    Program arguments: /home/philippe/.local/bin/clang-3.8 -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free
-disable-llvm-verifier -main-file-name tsts.cpp -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 -coverage-file /tmp/tsts.cpp
-resource-dir /home/philippe/.local/bin/../lib/clang/3.8.0 -c-isystem
/home/philippe/.usr/include -c-isystem /home/philippe/.arch/include
-cxx-isystem /home/philippe/.usr/include -cxx-isystem
/home/philippe/.arch/include -internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/5.3.1/../../../../include/c++/5.3.1
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/5.3.1/../../../../include/x86_64-linux-gnu/c++/5.3.1
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/5.3.1/../../../../include/x86_64-linux-gnu/c++/5.3.1
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/5.3.1/../../../../include/c++/5.3.1/backward
-internal-isystem /usr/local/include -internal-isystem
/home/philippe/.local/bin/../lib/clang/3.8.0/include -internal-externc-isystem
/usr/include/x86_64-linux-gnu -internal-externc-isystem /include
-internal-externc-isystem /usr/include -std=c++14 -fdeprecated-macro
-fdebug-compilation-dir /tmp -ferror-limit 19 -fmessage-length 136
-fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option
-fcolor-diagnostics -o tsts.o -x c++ tsts.cpp 
1.    tsts.cpp:3:16: current parser token '{'
2.    tsts.cpp:1:10: lambda expression parsing
3.    tsts.cpp:1:13: in compound statement ('{}')
clang-3.8: error: unable to execute command: Segmentation fault (core dumped)
clang-3.8: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.8.0 
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/philippe/.local/bin
clang-3.8: 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.8: 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.8: note: diagnostic msg: /tmp/tsts-6df5af.cpp
clang-3.8: note: diagnostic msg: /tmp/tsts-6df5af.sh
clang-3.8: note: diagnostic msg: 

********************

In case it is useful, here is the contents of the run script:

# Crash reproducer for clang version 3.8.0 
# Driver args: "--driver-mode=g++" "-std=c++14" "tsts.cpp" "-c"
# Original command:  "/home/philippe/.local/bin/clang-3.8" "-cc1" "-triple"
"x86_64-unknown-linux-gnu" "-emit-obj" "-mrelax-all" "-disable-free"
"-disable-llvm-verifier" "-main-file-name" "tsts.cpp" "-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"
"-coverage-file" "/tmp/tsts.cpp" "-resource-dir"
"/home/philippe/.local/bin/../lib/clang/3.8.0" "-c-isystem"
"/home/philippe/.usr/include" "-c-isystem" "/home/philippe/.arch/include"
"-cxx-isystem" "/home/philippe/.usr/include" "-cxx-isystem"
"/home/philippe/.arch/include" "-internal-isystem"
"/usr/lib/gcc/x86_64-linux-gnu/5.3.1/../../../../include/c++/5.3.1"
"-internal-isystem"
"/usr/lib/gcc/x86_64-linux-gnu/5.3.1/../../../../include/x86_64-linux-gnu/c++/5.3.1"
"-internal-isystem"
"/usr/lib/gcc/x86_64-linux-gnu/5.3.1/../../../../include/x86_64-linux-gnu/c++/5.3.1"
"-internal-isystem"
"/usr/lib/gcc/x86_64-linux-gnu/5.3.1/../../../../include/c++/5.3.1/backward"
"-internal-isystem" "/usr/local/include" "-internal-isystem"
"/home/philippe/.local/bin/../lib/clang/3.8.0/include"
"-internal-externc-isystem" "/usr/include/x86_64-linux-gnu"
"-internal-externc-isystem" "/include" "-internal-externc-isystem"
"/usr/include" "-std=c++14" "-fdeprecated-macro" "-fdebug-compilation-dir"
"/tmp" "-ferror-limit" "19" "-fmessage-length" "136" "-fobjc-runtime=gcc"
"-fcxx-exceptions" "-fexceptions" "-fdiagnostics-show-option"
"-fcolor-diagnostics" "-o" "tsts.o" "-x" "c++" "tsts.cpp"
 "/home/philippe/.local/bin/clang-3.8" "-cc1" "-triple"
"x86_64-unknown-linux-gnu" "-emit-obj" "-mrelax-all" "-disable-free"
"-disable-llvm-verifier" "-main-file-name" "tsts.cpp" "-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" "-c-isystem"
"/home/philippe/.usr/include" "-c-isystem" "/home/philippe/.arch/include"
"-cxx-isystem" "/home/philippe/.usr/include" "-cxx-isystem"
"/home/philippe/.arch/include" "-std=c++14" "-fdeprecated-macro"
"-ferror-limit" "19" "-fmessage-length" "136" "-fobjc-runtime=gcc"
"-fcxx-exceptions" "-fexceptions" "-fdiagnostics-show-option"
"-fcolor-diagnostics" "-x" "c++" "tsts-6df5af.cpp"

-- 
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/20160711/9e9f21c8/attachment-0001.html>


More information about the llvm-bugs mailing list