[llvm-bugs] [Bug 27080] New: lambda + "get" function call with explicit template parameter + duplicate "return" = backtrace (no "using std"): #include <memory> int main () { []() { return get<0> (0); return 0; }; }

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Mar 25 17:38:52 PDT 2016


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

            Bug ID: 27080
           Summary: lambda + "get" function call with explicit template
                    parameter + duplicate "return" = backtrace (no "using
                    std"): #include <memory> int main () {   []()   {
                    return get<0> (0); return 0;   }; }
           Product: clang
           Version: 3.8
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++14
          Assignee: unassignedclangbugs at nondot.org
          Reporter: safinaskar at mail.ru
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

The following code gives backtrace:

#include <memory> // <memory>, <string> give backtrace, <type_traits>,
<cstddef> - no

int
main ()
{
  []()
  {
    return get<0> (0); // "get" gives backtrace, "bar" does not :(
    return 0;
  };
}

Command line: clang++-3.8 -std=c++14 -o /dev/null
/proc/1/root/home/user/tmp/bug.cpp
Same for -std=c++1z.

Crash message and script follow. Preprocessed source is attached.

/proc/1/root/home/user/tmp/bug.cpp:8:12: error: use of undeclared identifier
'get'
    return get<0> (0); // "get" gives backtrace, "bar" does not :(
           ^
0  libLLVM-3.8.so.1 0x00007f642b704f15
llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 37
1  libLLVM-3.8.so.1 0x00007f642b703276 llvm::sys::RunSignalHandlers() + 54
2  libLLVM-3.8.so.1 0x00007f642b7033c9
3  libc.so.6        0x00007f642a4fb500
4  clang            0x0000000001322307
clang::ASTContext::getCanonicalFunctionResultType(clang::QualType) const + 7
5  clang            0x0000000000f49fec
clang::Sema::DeduceFunctionTypeFromReturnExpr(clang::FunctionDecl*,
clang::SourceLocation, clang::Expr*&, clang::AutoType*) + 268
6  clang            0x0000000000f4a546
clang::Sema::ActOnCapScopeReturnStmt(clang::SourceLocation, clang::Expr*) + 230
7  clang            0x0000000000f4ad9f
clang::Sema::BuildReturnStmt(clang::SourceLocation, clang::Expr*) + 543
8  clang            0x0000000000f4b665
clang::Sema::ActOnReturnStmt(clang::SourceLocation, clang::Expr*,
clang::Scope*) + 21
9  clang            0x0000000000b72d07 clang::Parser::ParseReturnStatement() +
215
10 clang            0x0000000000b746bf
clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::AllowedContsructsKind, clang::SourceLocation*,
clang::Parser::ParsedAttributesWithRange&) + 2207
11 clang            0x0000000000b74c76
clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::AllowedContsructsKind, clang::SourceLocation*) + 118
12 clang            0x0000000000b78ba9
clang::Parser::ParseCompoundStatementBody(bool) + 1721
13 clang            0x0000000000b4a802
clang::Parser::ParseLambdaExpressionAfterIntroducer(clang::LambdaIntroducer&) +
1938
14 clang            0x0000000000b4b683 clang::Parser::ParseLambdaExpression() +
291
15 clang            0x0000000000b38687 clang::Parser::ParseCastExpression(bool,
bool, bool&, clang::Parser::TypeCastState) + 6919
16 clang            0x0000000000b39bfd clang::Parser::ParseCastExpression(bool,
bool, clang::Parser::TypeCastState) + 29
17 clang            0x0000000000b39c89
clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) + 41
18 clang            0x0000000000b39d09
clang::Parser::ParseExpression(clang::Parser::TypeCastState) + 9
19 clang            0x0000000000b76de0 clang::Parser::ParseExprStatement() + 48
20 clang            0x0000000000b74aff
clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::AllowedContsructsKind, clang::SourceLocation*,
clang::Parser::ParsedAttributesWithRange&) + 3295
21 clang            0x0000000000b74c76
clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::AllowedContsructsKind, clang::SourceLocation*) + 118
22 clang            0x0000000000b78ba9
clang::Parser::ParseCompoundStatementBody(bool) + 1721
23 clang            0x0000000000b7b5e3
clang::Parser::ParseFunctionStatementBody(clang::Decl*,
clang::Parser::ParseScope&) + 275
24 clang            0x0000000000afec48
clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&,
clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) +
1224
25 clang            0x0000000000b1cbb8
clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, unsigned int,
clang::SourceLocation*, clang::Parser::ForRangeInit*) + 3368
26 clang            0x0000000000afb722
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier) + 274
27 clang            0x0000000000afbd71
28 clang            0x0000000000afbd9f
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier) + 31
29 clang            0x0000000000b0119f
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) + 255
30 clang            0x0000000000b01b74
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 420
31 clang            0x0000000000af6fbb clang::ParseAST(clang::Sema&, bool,
bool) + 587
32 clang            0x000000000095f4c6 clang::FrontendAction::Execute() + 262
33 clang            0x0000000000935726
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 262
34 clang            0x00000000009d7e43
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1939
35 clang            0x0000000000689780 cc1_main(llvm::ArrayRef<char const*>,
char const*, void*) + 2256
36 clang            0x0000000000686344 main + 6164
37 libc.so.6        0x00007f642a4e8610 __libc_start_main + 240
38 clang            0x0000000000687c69 _start + 41
Stack dump:
0.    Program arguments: /usr/lib/llvm-3.8/bin/clang -cc1 -triple
x86_64-pc-linux-gnu -emit-obj -mrelax-all -disable-free -disable-llvm-verifier
-main-file-name bug.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 -resource-dir /usr/lib/llvm-3.8/bin/../lib/clang/3.8.0
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/5.3.1/../../../../include/c++/5.3.1
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/5.3.1/../../../../include/x86_64-linux-gnu/c++/5.3.1
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/5.3.1/../../../../include/x86_64-linux-gnu/c++/5.3.1
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/5.3.1/../../../../include/c++/5.3.1/backward
-internal-isystem /usr/local/include -internal-isystem
/usr/lib/llvm-3.8/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 / -ferror-limit 19 -fmessage-length 0
-fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -o
/tmp/bug-62ddb4.o -x c++ /proc/1/root/home/user/tmp/bug.cpp 
1.    /proc/1/root/home/user/tmp/bug.cpp:9:13: current parser token ';'
2.    /proc/1/root/home/user/tmp/bug.cpp:5:1: parsing function body 'main'
3.    /proc/1/root/home/user/tmp/bug.cpp:5:1: in compound statement ('{}')
4.    /proc/1/root/home/user/tmp/bug.cpp:6:3: lambda expression parsing
5.    /proc/1/root/home/user/tmp/bug.cpp:7:3: in compound statement ('{}')
clang: error: unable to execute command: Segmentation fault
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.8.0-2 (tags/RELEASE_380/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
clang: 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: note: diagnostic msg: 
********************

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

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

# Crash reproducer for clang version 3.8.0-2 (tags/RELEASE_380/final)
# Driver args: "--driver-mode=g++" "-std=c++14" "-o" "/dev/null"
"/proc/1/root/home/user/tmp/bug.cpp"
# Original command:  "/usr/lib/llvm-3.8/bin/clang" "-cc1" "-triple"
"x86_64-pc-linux-gnu" "-emit-obj" "-mrelax-all" "-disable-free"
"-disable-llvm-verifier" "-main-file-name" "bug.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"
"-resource-dir" "/usr/lib/llvm-3.8/bin/../lib/clang/3.8.0" "-internal-isystem"
"/usr/bin/../lib/gcc/x86_64-linux-gnu/5.3.1/../../../../include/c++/5.3.1"
"-internal-isystem"
"/usr/bin/../lib/gcc/x86_64-linux-gnu/5.3.1/../../../../include/x86_64-linux-gnu/c++/5.3.1"
"-internal-isystem"
"/usr/bin/../lib/gcc/x86_64-linux-gnu/5.3.1/../../../../include/x86_64-linux-gnu/c++/5.3.1"
"-internal-isystem"
"/usr/bin/../lib/gcc/x86_64-linux-gnu/5.3.1/../../../../include/c++/5.3.1/backward"
"-internal-isystem" "/usr/local/include" "-internal-isystem"
"/usr/lib/llvm-3.8/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" "/" "-ferror-limit" "19" "-fmessage-length" "0"
"-fobjc-runtime=gcc" "-fcxx-exceptions" "-fexceptions"
"-fdiagnostics-show-option" "-o" "/tmp/bug-62ddb4.o" "-x" "c++"
"/proc/1/root/home/user/tmp/bug.cpp"
 "/usr/lib/llvm-3.8/bin/clang" "-cc1" "-triple" "x86_64-pc-linux-gnu"
"-emit-obj" "-mrelax-all" "-disable-free" "-disable-llvm-verifier"
"-main-file-name" "bug.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" "-std=c++14"
"-fdeprecated-macro" "-ferror-limit" "19" "-fmessage-length" "0"
"-fobjc-runtime=gcc" "-fcxx-exceptions" "-fexceptions"
"-fdiagnostics-show-option" "-x" "c++" "bug-fc39f7.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/20160326/58db118e/attachment.html>


More information about the llvm-bugs mailing list