<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - clang++ segmentation faults when compiling file"
   href="http://llvm.org/bugs/show_bug.cgi?id=22610">22610</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang++ segmentation faults when compiling file
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.5
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>LLVM Codegen
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>apurva.1618@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I am using my own build of clang (built using the scripts at
<a href="https://github.com/rsmmr/install-clang">https://github.com/rsmmr/install-clang</a>) and using a custom build gcc toolchain
using release version 4.8.3. 

I use CMAKE to build my project, and just started experimented building it
using clang++ instead of g++.

Clang successfully builds all but one of my make targets. On the last one, it
fails with the following segmentation fault. I have attached the preprocessed
sources and run scripts below. 

Let me know if you need any more information, or would like me to experiment
with some clang patches, etc.

Thanks,
Apurva

Here is the error output:

[amehta@amehta-ld1 debug]$ make
[  1%] Built target default_index_metadata
[  2%] Built target thrift_gen_cpp
[  2%] Built target default_scorer
[  3%] Built target default_top_hits
[  6%] Built target buffers
[ 10%] Built target dataloader
[ 11%] Built target cityperf
[ 12%] Built target fbfingerprinttest
[ 12%] Built target fbstringtest
[ 13%] Built target hashtest
[ 18%] Built target indexer
[ 19%] Built target build_index
[ 19%] Built target generate_index_input
[ 29%] Built target query
[ 44%] Built target searcher
[ 44%] Built target lock_helper
[ 49%] Built target bsl
[ 61%] Built target galene_jni
[ 62%] Built target run_search
[ 62%] Built target buffer_class_gen
[ 63%] Built target thrift_gen_java
[ 66%] Built target api
[ 70%] Built target relevance
[ 71%] Built target class_gen
[ 73%] Built target node
[ 74%] Building CXX object
galene/server/CMakeFiles/node_server.dir/node_server.cc.o
0  libLLVMSupport.so       0x00007f8b226764a5
llvm::sys::PrintStackTrace(_IO_FILE*) + 37
1  libLLVMSupport.so       0x00007f8b22676833
2  libpthread.so.0         0x000000391c00f710
3  libLLVMSupport.so       0x00007f8b22643036
llvm::StringMapImpl::FindKey(llvm::StringRef) const + 198
4  libLLVMCore.so          0x00007f8b23f115d0
llvm::Module::getNamedValue(llvm::StringRef) const + 16
5  libclangCodeGen.so      0x00007f8b2086b717
6  libclangCodeGen.so      0x00007f8b2086b4cc
7  libclangCodeGen.so      0x00007f8b207861ae
8  libclangCodeGen.so      0x00007f8b2077e92b
clang::CodeGen::CodeGenFunction::EmitDeclRefLValue(clang::DeclRefExpr const*) +
907
9  libclangCodeGen.so      0x00007f8b2077756c
clang::CodeGen::CodeGenFunction::EmitLValue(clang::Expr const*) + 444
10 libclangCodeGen.so      0x00007f8b20782283
clang::CodeGen::CodeGenFunction::EmitCastLValue(clang::CastExpr const*) + 339
11 libclangCodeGen.so      0x00007f8b207773f0
clang::CodeGen::CodeGenFunction::EmitLValue(clang::Expr const*) + 64
12 libclangCodeGen.so      0x00007f8b20779f30
clang::CodeGen::CodeGenFunction::EmitReferenceBindingToExpr(clang::Expr const*)
+ 32
13 libclangCodeGen.so      0x00007f8b2073fa11
clang::CodeGen::CodeGenFunction::EmitCallArg(clang::CodeGen::CallArgList&,
clang::Expr const*, clang::QualType) + 545
14 libclangCodeGen.so      0x00007f8b2073f6a2
clang::CodeGen::CodeGenFunction::EmitCallArgs(clang::CodeGen::CallArgList&,
llvm::ArrayRef<clang::QualType>, clang::ConstExprIterator,
clang::ConstExprIterator, bool) + 546
15 libclangCodeGen.so      0x00007f8b20707fc8
16 libclangCodeGen.so      0x00007f8b20787d45
clang::CodeGen::CodeGenFunction::EmitCall(clang::QualType, llvm::Value*,
clang::SourceLocation, clang::CodeGen::ReturnValueSlot,
clang::ConstExprIterator, clang::ConstExprIterator, clang::Decl const*) + 1765
17 libclangCodeGen.so      0x00007f8b20787538
clang::CodeGen::CodeGenFunction::EmitCallExpr(clang::CallExpr const*,
clang::CodeGen::ReturnValueSlot) + 648
18 libclangCodeGen.so      0x00007f8b207aadef
19 libclangCodeGen.so      0x00007f8b207a2ddf
clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool) + 79
20 libclangCodeGen.so      0x00007f8b20777206
clang::CodeGen::CodeGenFunction::EvaluateExprAsBool(clang::Expr const*) + 358
21 libclangCodeGen.so      0x00007f8b20825e3b
clang::CodeGen::CodeGenFunction::EmitBranchOnBoolExpr(clang::Expr const*,
llvm::BasicBlock*, llvm::BasicBlock*, unsigned long) + 1115
22 libclangCodeGen.so      0x00007f8b2080d945
clang::CodeGen::CodeGenFunction::EmitIfStmt(clang::IfStmt const&) + 565
23 libclangCodeGen.so      0x00007f8b2080cda9
clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*) + 585
24 libclangCodeGen.so      0x00007f8b2081582b
clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt
const&, bool, clang::CodeGen::AggValueSlot) + 91
25 libclangCodeGen.so      0x00007f8b2082527e
clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl,
llvm::Function*, clang::CodeGen::CGFunctionInfo const&) + 1214
26 libclangCodeGen.so      0x00007f8b20831d67
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl,
llvm::GlobalValue*) + 871
27 libclangCodeGen.so      0x00007f8b2082e922
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl,
llvm::GlobalValue*) + 370
28 libclangCodeGen.so      0x00007f8b2082a6ae
clang::CodeGen::CodeGenModule::Release() + 30
29 libclangCodeGen.so      0x00007f8b20820da5
30 libclangParse.so        0x00007f8b1ef1f733 clang::ParseAST(clang::Sema&,
bool, bool) + 467
31 libclangFrontend.so     0x00007f8b217da099 clang::FrontendAction::Execute()
+ 57
32 libclangFrontend.so     0x00007f8b217a9a43
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 787
33 libclangFrontendTool.so 0x00007f8b2153b0e2
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 3538
34 clang++                 0x000000000040bb72 cc1_main(char const**, char
const**, char const*, void*) + 530
35 clang++                 0x0000000000407d73 main + 1059
36 libc.so.6               0x000000391b81ed5d __libc_start_main + 253
37 clang++                 0x0000000000407789
Stack dump:
0.      Program arguments:
/home/amehta/native-repo/clang/clang/3.5.1.6/bin/clang++ -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free
-disable-llvm-verifier -main-file-name node_server.cc -mrelocation-model pic
-pic-level 2 -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases
-munwind-tables -fuse-init-array -target-cpu x86-64 -target-feature +ssse3 -g
-dwarf-column-info -coverage-file
/home/amehta/workspace/galene/galene-experimental/tmp/galene-diskindex_trunk/galene-diskindex/debug/galene/server/CMakeFiles/node_server.dir/node_server.cc.o
-resource-dir
/home/amehta/native-repo/clang/clang/3.5.1.6/bin/../lib/clang/3.5.1 -D
GTEST_HAS_TR1_TUPLE=0 -D node_server_EXPORTS -D FOLLY_X64 -I
/home/amehta/workspace/galene/galene-experimental/tmp/galene-diskindex_trunk/galene-diskindex
-I /home/amehta/native-repo/boost/boost/1.55.0.6/include -I
/home/amehta/native-repo/glog/glog/0.3.3.4/include -I
/home/amehta/native-repo/gflags/gflags/1.6.0.3/include -I
/home/amehta/native-repo/sparsehashmap/sparsehashmap/2.0.2.5/include -I
/home/amehta/native-repo/cityhash/cityhash/1.1.1.6/include -I
/home/amehta/native-repo/avro-cpp/avro-cpp/1.7.6.7/include -I
/home/amehta/native-repo/folly/folly/0.0.6/include -I
/home/amehta/native-repo/gtest/gtest/1.7.0.3/include -I
/home/amehta/native-repo/double-conversion/double-conversion/1.1.5.3/include -I
/home/amehta/native-repo/libyaml/libyaml/0.1.5.1/include -I
/home/amehta/native-repo/thrift/thrift/0.9.2.3/include -I
/home/amehta/workspace/galene/galene-experimental/tmp/galene-diskindex_trunk/galene-diskindex/debug
-internal-isystem /home/amehta/native-repo/clang/clang/3.5.1.6/bin/../include
-internal-isystem
/home/amehta/native-repo/gcc/gcc/4.8.3.4/lib/gcc/x86_64-unknown-linux-gnu/4.8.3/../../../../include/c++/4.8.3
-internal-isystem
/home/amehta/native-repo/gcc/gcc/4.8.3.4/lib/gcc/x86_64-unknown-linux-gnu/4.8.3/../../../../include/c++/4.8.3/x86_64-unknown-linux-gnu
-internal-isystem
/home/amehta/native-repo/gcc/gcc/4.8.3.4/lib/gcc/x86_64-unknown-linux-gnu/4.8.3/../../../../include/c++/4.8.3/backward
-internal-isystem /usr/local/include -internal-isystem
/home/amehta/native-repo/clang/clang/3.5.1.6/bin/../lib/clang/3.5.1/include
-internal-externc-isystem
/export/home/tester/hudson/data/workspace/MP_TRUNKDEV_POSTCOMMIT/clang_55366a71c30b9b250648726b18f54a8b8d362e11/clang/release/install/include/c++/v1
-internal-externc-isystem /usr/include -internal-externc-isystem /usr/include/
-internal-externc-isystem /usr/include/ -Wall -Wno-unused-local-typedefs
-Wno-mismatched-tags -Wno-unknown-warning-option -Wno-deprecated-register
-std=c++11 -fdeprecated-macro -fdebug-compilation-dir
/home/amehta/workspace/galene/galene-experimental/tmp/galene-diskindex_trunk/galene-diskindex/debug/galene/server
-ferror-limit 19 -fmessage-length 101 -mstackrealign -fobjc-runtime=gcc
-fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -o
CMakeFiles/node_server.dir/node_server.cc.o -x c++
/home/amehta/workspace/galene/galene-experimental/tmp/galene-diskindex_trunk/galene-diskindex/galene/server/node_server.cc
1.      <eof> parser at end of file
2.      Per-file LLVM IR generation
3.     
/home/amehta/workspace/galene/galene-experimental/tmp/galene-diskindex_trunk/galene-diskindex/galene/server/node_server.cc:137:22:
Generating code for declaration 'SearchServiceThreadLocalFactory::getHandler'
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.5.1
Target: x86_64-unknown-linux-gnu
Thread model: posix
clang++: note: diagnostic msg: PLEASE submit a bug report to
<a href="http://llvm.org/bugs/">http://llvm.org/bugs/</a> 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/node_server-81aaee.cpp
clang++: note: diagnostic msg: /tmp/node_server-81aaee.sh
clang++: note: diagnostic msg:

********************
make[2]: *** [galene/server/CMakeFiles/node_server.dir/node_server.cc.o] Error
254
make[1]: *** [galene/server/CMakeFiles/node_server.dir/all] Error 2
make: *** [all] Error 2</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>