<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 fault/consumes all memory"
   href="http://llvm.org/bugs/show_bug.cgi?id=16239">16239</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang segmentation fault/consumes all memory
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>trunk
          </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>-New Bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>tmmikolajczyk@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>Created <span class=""><a href="attachment.cgi?id=10635" name="attach_10635" title="the code and the requested compilation output">attachment 10635</a> <a href="attachment.cgi?id=10635&action=edit" title="the code and the requested compilation output">[details]</a></span>
the code and the requested compilation output

Clang crashes compiling the following code:

template<typename T>
struct Move
{
    Move(T t);
    T rsc;
};

class Foo
{
public:
    Foo() {}
    Foo(Move<Foo> m);

private:
    // NON-CONST ARGS. CLANG DOES NOT CRASH AND REPORTS PROPER DIAGNOSTICS WHEN
THEY ARE CONST
    Foo(Foo&);
    Foo& operator=(Foo&);
};

Foo create()
{
    return Foo();
}

int main()
{
    create();
    return 0;
}

Please note that when the copy constructor and assignment operator argument is
defined as const l-value ref the compiler generates proper diagnostic.

The semantic of this piece of code is irrelevant. It is a fragment of something
bigger. What is important that when compiling a wider piece I'm not able to
share, the compiler sometimes consumes all the available memory and makes the
system unresponsive eventually. It's not easy to reproduce this behavior with
an equivalent code but hopefully it concerns the same issue as observed when
compiling the attached one.

This behavior happens on clang 3.2 and also on the latest repo version (git
rev. d87bd5627e5b78cb556d6c7b5aa76ae3d55d8acf).

The attached package contains all the requested information.

My env:
OS: ArchLinux,
uname -a
Linux 3.9.4-1-ARCH #1 SMP PREEMPT Sat May 25 16:14:55 CEST 2013 x86_64
GNU/Linux
glibc: 2.17.6</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>