[LLVMbugs] [Bug 16854] New: clang crash when doing tuple magic

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Aug 10 13:07:57 PDT 2013


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

            Bug ID: 16854
           Summary: clang crash when doing tuple magic
           Product: clang
           Version: 3.3
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: janezz55 at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

I get a crash while compiling this code:

template <std::size_t O, class C, std::size_t ...I>
inline C get_tuple_arg(lua_State* const L, indices<I...> const)
{
  C result;

  [](...){}((
    lua_rawgeti(L, O, I + 1),
    std::get<I>(result) = get_arg<-1,
      typename std::tuple_element<I, C>::type>(L),
    lua_pop(L, 1),
    0)...);

  return result;
}

The lambda trick can be omitted and clang will still crash.

The complete code is here:
https://code.google.com/p/lualite/

gcc groks the code without issue.

0  libLLVM-3.3.so  0x00007f037810a112 llvm::sys::PrintStackTrace(_IO_FILE*) +
34
1  libLLVM-3.3.so  0x00007f0378109f79
2  libpthread.so.0 0x00007f03772110e0
3  clang           0x00000000007d39dd
4  clang           0x000000000082d5f1
clang::CodeGen::CodeGenFunction::EmitLValueForField(clang::CodeGen::LValue,
clang::FieldDecl const*) + 1105
5  clang           0x000000000082de06
clang::CodeGen::CodeGenFunction::EmitLValueForFieldInitialization(clang::CodeGen::LValue,
clang::FieldDecl const*) + 214
6  clang           0x000000000083ce90
7  clang           0x00000000005608b8
8  clang           0x000000000083e625
9  clang           0x00000000005615ed
10 clang           0x000000000083a754
clang::CodeGen::CodeGenFunction::EmitAggExpr(clang::Expr const*,
clang::CodeGen::AggValueSlot) + 4820
11 clang           0x0000000000826cdd
clang::CodeGen::CodeGenFunction::EmitAnyExpr(clang::Expr const*,
clang::CodeGen::AggValueSlot, bool) + 189
12 clang           0x0000000000831b7f
clang::CodeGen::CodeGenFunction::EmitIgnoredExpr(clang::Expr const*) + 47
13 clang           0x00000000008b6652
clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*) + 98
14 clang           0x00000000008b683f
clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt
const&, bool, clang::CodeGen::AggValueSlot) + 79
15 clang           0x000000000078d972
clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::CodeGen::FunctionArgList&)
+ 82
16 clang           0x0000000000792014
clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl,
llvm::Function*, clang::CodeGen::CGFunctionInfo const&) + 484
17 clang           0x00000000007a042a
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl)
+ 362
18 clang           0x00000000007a0e8b
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl) + 283
19 clang           0x00000000007a1a4d
clang::CodeGen::CodeGenModule::EmitDeferred() + 125
20 clang           0x00000000007a1a89 clang::CodeGen::CodeGenModule::Release()
+ 9
21 clang           0x0000000000781ab0
22 clang           0x00000000008d024b clang::ParseAST(clang::Sema&, bool, bool)
+ 507
23 clang           0x0000000000639339 clang::FrontendAction::Execute() + 169
24 clang           0x000000000061a522
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 290
25 clang           0x0000000000605bc7
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1591
26 clang           0x00000000006010c8 cc1_main(char const**, char const**, char
const*, void*) + 1208
27 clang           0x00000000005ffa6b main + 7899
28 libc.so.6       0x00007f037695ca15 __libc_start_main + 245
29 clang           0x00000000006000d1
Stack dump:
0.      Program arguments: /usr/bin/clang -cc1 -triple x86_64-unknown-linux-gnu
-emit-obj -disable-free -disable-llvm-verifier -main-file-name testlua.cpp
-mrelocation-model static -menable-no-infs -menable-no-nans
-menable-unsafe-fp-math -ffp-contract=fast -ffast-math -masm-verbose
-mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64
-target-linker-version 2.23.2 -momit-leaf-frame-pointer -coverage-file
/home/janezz/projects/engine3/testlua/.build/clang-linux-3.3/release/link-static/threading-multi/testlua.o
-resource-dir /usr/bin/../lib/clang/3.3 -D BOOST_DISABLE_ASSERTS -D NDEBUG -I
glew -I glew -I .. -internal-isystem
/usr/lib64/gcc/x86_64-unknown-linux-gnu/4.8.1/../../../../include/c++/4.8.1
-internal-isystem
/usr/lib64/gcc/x86_64-unknown-linux-gnu/4.8.1/../../../../include/c++/4.8.1/x86_64-unknown-linux-gnu
-internal-isystem
/usr/lib64/gcc/x86_64-unknown-linux-gnu/4.8.1/../../../../include/c++/4.8.1/backward
-internal-isystem
/usr/lib64/gcc/x86_64-unknown-linux-gnu/4.8.1/../../../../include/x86_64-unknown-linux-gnu/c++/4.8.1
-internal-isystem /usr/local/include -internal-isystem
/usr/bin/../lib/clang/3.3/include -internal-externc-isystem /include
-internal-externc-isystem /usr/include -O3 -Wno-inline -Wall -std=c++11
-fdeprecated-macro -fdebug-compilation-dir
/home/janezz/projects/engine3/testlua -ferror-limit 19 -fmessage-length 0
-pthread -mstackrealign -fobjc-runtime=gcc -fobjc-default-synthesize-properties
-fcxx-exceptions -fexceptions -fdiagnostics-show-option -backend-option
-vectorize-loops -o
.build/clang-linux-3.3/release/link-static/threading-multi/testlua.o -x c++
../lualite/testlua.cpp 
1.      <eof> parser at end of file
2.      Per-file LLVM IR generation
3.      ../lualite/lualite.hpp:612:13: Generating code for declaration
'lualite::detail::set_tuple_result'
clang: error: unable to execute command: Segmentation fault (core dumped)
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.3 (tags/RELEASE_33/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
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/testlua-p0hQqb.cpp
clang: note: diagnostic msg: /tmp/testlua-p0hQqb.sh
clang: note: diagnostic msg:

-- 
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/20130810/24b0333f/attachment.html>


More information about the llvm-bugs mailing list