<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 fails to compile code with Segmentation Fault"
   href="http://llvm.org/bugs/show_bug.cgi?id=16260">16260</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Clang fails to compile code with Segmentation Fault
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>3.2
          </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>C++11
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>0coming.soon@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Clang fails to compile the following code

$ cat main.cpp

#include <list>
#include <memory>

template <typename T>
class CreateTypes
{
public:
    CreateTypes()
    {
        [] (...)
        {

        }
        (
            (
                m_types.push_back(std::unique_ptr<T>(new T()))
            )
        );
    }

private:
    std::list<std::unique_ptr<int>> m_types;
};

int main()
{
    CreateTypes<int> createTypes;
    return 0;
}

$ # No matter if use -stdlib=libc++ instead of libstdc++
$ clang++ -std=c++11 main.cpp

0  libLLVM-3.2.so  0xb6d35c98
1  libLLVM-3.2.so  0xb6d36064
2  linux-gate.so.1 0xb7726400 __kernel_sigreturn + 0
3  libLLVM-3.2.so  0xb6e7d9c5
llvm::SelectionDAGBuilder::LowerCallTo(llvm::ImmutableCallSite, llvm::SDValue,
bool, llvm::MachineBasicBlock*) + 677
4  libLLVM-3.2.so  0xb6e89aff
llvm::SelectionDAGBuilder::visitInvoke(llvm::InvokeInst const&) + 687
5  libLLVM-3.2.so  0xb6e69257 llvm::SelectionDAGBuilder::visit(unsigned int,
llvm::User const&) + 1383
6  libLLVM-3.2.so  0xb6e8f157
llvm::SelectionDAGBuilder::visit(llvm::Instruction const&) + 71
7  libLLVM-3.2.so  0xb6ea202d
llvm::SelectionDAGISel::SelectBasicBlock(llvm::ilist_iterator<llvm::Instruction
const>, llvm::ilist_iterator<llvm::Instruction const>, bool&) + 61
8  libLLVM-3.2.so  0xb6ea394b
llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) + 1195
9  libLLVM-3.2.so  0xb6ea4724
llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) + 916
10 libLLVM-3.2.so  0xb6916f8e
llvm::MachineFunctionPass::runOnFunction(llvm::Function&) + 126
11 libLLVM-3.2.so  0xb6668819
llvm::FPPassManager::runOnFunction(llvm::Function&) + 537
12 libLLVM-3.2.so  0xb6668a6c llvm::FPPassManager::runOnModule(llvm::Module&) +
76
13 libLLVM-3.2.so  0xb6668c78 llvm::MPPassManager::runOnModule(llvm::Module&) +
472
14 libLLVM-3.2.so  0xb6668d91 llvm::PassManagerImpl::run(llvm::Module&) + 113
15 libLLVM-3.2.so  0xb6668dd6 llvm::PassManager::run(llvm::Module&) + 38
16 clang           0x0838c2cb
clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::CodeGenOptions
const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::Module*,
clang::BackendAction, llvm::raw_ostream*) + 3899
17 clang           0x08389b48
18 clang           0x084e440c clang::ParseAST(clang::Sema&, bool, bool) + 604
19 clang           0x08241b3c clang::ASTFrontendAction::ExecuteAction() + 108
20 clang           0x08388b3a clang::CodeGenAction::ExecuteAction() + 42
21 clang           0x08242248 clang::FrontendAction::Execute() + 88
22 clang           0x08220935
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 261
23 clang           0x0820a4f7
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1479
24 clang           0x08205838 cc1_main(char const**, char const**, char const*,
void*) + 1224
25 clang           0x082042b1 main + 8081
26 libc.so.6       0xb5f9b7c3 __libc_start_main + 243
27 clang           0x08204865
Stack dump:
0.    Program arguments: /usr/bin/clang -cc1 -triple i386-pc-linux-gnu
-emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name
main.cpp -mrelocation-model static -mdisable-fp-elim -fmath-errno -masm-verbose
-mconstructor-aliases -fuse-init-array -target-cpu pentium4
-target-linker-version 2.23.2 -momit-leaf-frame-pointer -resource-dir
/usr/bin/../lib/clang/3.2 -fmodule-cache-path /var/tmp/clang-module-cache
-internal-isystem
/usr/lib/gcc/i686-pc-linux-gnu/4.8.1/../../../../include/c++/4.8.1
-internal-isystem
/usr/lib/gcc/i686-pc-linux-gnu/4.8.1/../../../../include/c++/4.8.1/i686-pc-linux-gnu
-internal-isystem
/usr/lib/gcc/i686-pc-linux-gnu/4.8.1/../../../../include/c++/4.8.1/backward
-internal-isystem /usr/local/include -internal-isystem
/usr/bin/../lib/clang/3.2/include -internal-externc-isystem /include
-internal-externc-isystem /usr/include -std=c++11 -fdeprecated-macro
-fdebug-compilation-dir /home/soon/Src/C++/main -ferror-limit 19
-fmessage-length 80 -mstackrealign -fobjc-runtime=gcc -fcxx-exceptions
-fexceptions -fdiagnostics-show-option -fcolor-diagnostics -o
/tmp/main-qaDTzu.o -x c++ main.cpp 
1.    <eof> parser at end of file
2.    Code generation
3.    Running pass 'Function Pass Manager' on module 'main.cpp'.
4.    Running pass 'X86 DAG->DAG Instruction Selection' on function
'@_ZN11CreateTypesIiEC2Ev'
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.2 (tags/RELEASE_32/final)
Target: i386-pc-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/main-51VESR.cpp
clang: note: diagnostic msg: /tmp/main-51VESR.sh
clang: note: diagnostic msg: 

Second attachment(/tmp/main-51VESR.sh):

/usr/bin/clang -cc1 -triple i386-pc-linux-gnu -emit-obj -mrelax-all
-disable-free -disable-llvm-verifier -main-file-name main.cpp
-mrelocation-model static -mdisable-fp-elim -fmath-errno -masm-verbose
-mconstructor-aliases -fuse-init-array -target-cpu pentium4
-target-linker-version 2.23.2 -momit-leaf-frame-pointer -std=c++11
-fdeprecated-macro -ferror-limit 19 -fmessage-length 80 -mstackrealign
-fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option
-fcolor-diagnostics -x c++ main-51VESR.cpp</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>