[LLVMbugs] [Bug 20371] New: Crash when parameterizing a const auto variable

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Jul 20 04:00:52 PDT 2014


http://llvm.org/bugs/show_bug.cgi?id=20371

            Bug ID: 20371
           Summary: Crash when parameterizing a const auto variable
           Product: clang
           Version: 3.4
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: guigo.lourenco at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

The following code crashes Clang 3.4.2 under Arch Linux x86-64:

////////////
template <typename T>
const auto select2nd = std::bind(&T::value_type::second, std::_1);

int main() {
  std::map<int, int> m;
  std::vector<int> v;

  std::transform(m.begin(), m.end(), std::back_inserter(v),
select2nd<std::map<int, int>>);

  return 0;
}
////////////

Stack trace:

0  libLLVM-3.4.so  0x00007fd12e23b8b2 llvm::sys::PrintStackTrace(_IO_FILE*) +
50
1  libLLVM-3.4.so  0x00007fd12e23b30c
2  libpthread.so.0 0x00007fd12d2a34b0
3  libLLVM-3.4.so  0x00007fd12da8a054 llvm::VectorType::get(llvm::Type*,
unsigned int) + 20
4  clang           0x0000000000846845
clang::CodeGen::CodeGenTypes::ConvertType(clang::QualType) + 1237
5  clang           0x000000000084788f
clang::CodeGen::CodeGenTypes::ConvertTypeForMem(clang::QualType) + 15
6  clang           0x000000000084650d
clang::CodeGen::CodeGenTypes::ConvertType(clang::QualType) + 413
7  clang           0x0000000000873921
8  clang           0x0000000000875181
9  clang           0x00000000008883af
clang::CodeGen::CodeGenTypes::arrangeLLVMFunctionInfo(clang::CanQual<clang::Type>,
llvm::ArrayRef<clang::CanQual<clang::Type> >, clang::FunctionType::ExtInfo,
clang::CodeGen::RequiredArgs) + 479
10 clang           0x000000000088dff0
11 clang           0x000000000088e069
clang::CodeGen::CodeGenTypes::arrangeFreeFunctionType(clang::CanQual<clang::FunctionProtoType>)
+ 89
12 clang           0x00000000008477de
clang::CodeGen::CodeGenTypes::ConvertType(clang::QualType) + 5230
13 clang           0x000000000084788f
clang::CodeGen::CodeGenTypes::ConvertTypeForMem(clang::QualType) + 15
14 clang           0x0000000000846743
clang::CodeGen::CodeGenTypes::ConvertType(clang::QualType) + 979
15 clang           0x00000000008883fa
clang::CodeGen::CodeGenTypes::arrangeLLVMFunctionInfo(clang::CanQual<clang::Type>,
llvm::ArrayRef<clang::CanQual<clang::Type> >, clang::FunctionType::ExtInfo,
clang::CodeGen::RequiredArgs) + 554
16 clang           0x000000000088dff0
17 clang           0x000000000088e069
clang::CodeGen::CodeGenTypes::arrangeFreeFunctionType(clang::CanQual<clang::FunctionProtoType>)
+ 89
18 clang           0x00000000008477de
clang::CodeGen::CodeGenTypes::ConvertType(clang::QualType) + 5230
19 clang           0x0000000000834bf7
clang::CodeGen::CodeGenModule::GetAddrOfFunction(clang::GlobalDecl,
llvm::Type*, bool) + 103
20 clang           0x00000000008b7d5a
21 clang           0x00000000008c0a09
clang::CodeGen::CodeGenFunction::EmitDeclRefLValue(clang::DeclRefExpr const*) +
905
22 clang           0x00000000008c44c5
clang::CodeGen::CodeGenFunction::EmitLValue(clang::Expr const*) + 821
23 clang           0x00000000005732b7
24 clang           0x00000000008e6f21
25 clang           0x00000000008e7cad
clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool) + 77
26 clang           0x00000000008c70a0
clang::CodeGen::CodeGenFunction::EmitCallExpr(clang::CallExpr const*,
clang::CodeGen::ReturnValueSlot) + 400
27 clang           0x000000000056f1e9
28 clang           0x00000000008cc0a4
clang::CodeGen::CodeGenFunction::EmitAggExpr(clang::Expr const*,
clang::CodeGen::AggValueSlot) + 4516
29 clang           0x00000000008b9975
clang::CodeGen::CodeGenFunction::EmitAnyExpr(clang::Expr const*,
clang::CodeGen::AggValueSlot, bool) + 213
30 clang           0x00000000008c480f
clang::CodeGen::CodeGenFunction::EmitIgnoredExpr(clang::Expr const*) + 47
31 clang           0x0000000000814a5f
clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*) + 111
32 clang           0x0000000000814ca0
clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt
const&, bool, clang::CodeGen::AggValueSlot) + 96
33 clang           0x0000000000821873
clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::CodeGen::FunctionArgList&,
clang::Stmt const*) + 35
34 clang           0x0000000000825fd1
clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl,
llvm::Function*, clang::CodeGen::CGFunctionInfo const&) + 625
35 clang           0x0000000000834d7a
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl)
+ 378
36 clang           0x000000000083592b
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl) + 315
37 clang           0x0000000000837fe4
clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) + 1060
38 clang           0x0000000000838d0b
39 clang           0x00000000007df063
40 clang           0x00000000007de7ed
41 clang           0x00000000009486de clang::ParseAST(clang::Sema&, bool, bool)
+ 334
42 clang           0x000000000067f78a clang::FrontendAction::Execute() + 170
43 clang           0x000000000065e9e5
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 309
44 clang           0x000000000064832c
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1564
45 clang           0x0000000000643a48 cc1_main(char const**, char const**, char
const*, void*) + 1208
46 clang           0x0000000000642c24 main + 7332
47 libc.so.6       0x00007fd12c9e1000 __libc_start_main + 240
48 clang           0x00000000006433cf
Stack dump:
0.    Program arguments: /usr/bin/clang -cc1 -triple x86_64-unknown-linux-gnu
-emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name
test2.cpp -mrelocation-model static -mdisable-fp-elim -fmath-errno
-masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array
-target-cpu x86-64 -target-linker-version 2.24 -resource-dir
/usr/bin/../lib/clang/3.4.2 -internal-isystem
/usr/bin/../lib64/gcc/x86_64-unknown-linux-gnu/4.9.0/../../../../include/c++/4.9.0
-internal-isystem
/usr/bin/../lib64/gcc/x86_64-unknown-linux-gnu/4.9.0/../../../../include/c++/4.9.0/x86_64-unknown-linux-gnu
-internal-isystem
/usr/bin/../lib64/gcc/x86_64-unknown-linux-gnu/4.9.0/../../../../include/c++/4.9.0/backward
-internal-isystem
/usr/bin/../lib64/gcc/x86_64-unknown-linux-gnu/4.9.0/../../../../include/x86_64-unknown-linux-gnu/c++/4.9.0
-internal-isystem /usr/local/include -internal-isystem
/usr/bin/../lib/clang/3.4.2/include -internal-externc-isystem /include
-internal-externc-isystem /usr/include -std=c++1y -fdeprecated-macro
-fdebug-compilation-dir /home/rodrigo/workarea/repos/metin2-server/game
-ferror-limit 19 -fmessage-length 168 -mstackrealign -fobjc-runtime=gcc
-fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics
-vectorize-slp -o /tmp/test2-540f03.o -x c++ test2.cpp 
1.    <eof> parser at end of file
2.    test2.cpp:11:5: LLVM IR generation of declaration 'main'
3.    test2.cpp:11:5: Generating code for declaration 'main'
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.4.2 (tags/RELEASE_34/dot2-final)
Target: x86_64-unknown-linux-gnu
Thread model: posix

-- 
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/20140720/928c1379/attachment.html>


More information about the llvm-bugs mailing list