<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++ crashes when compiling c++ code, after eating all available memory (with -O2 activated)."
   href="http://llvm.org/bugs/show_bug.cgi?id=17520">17520</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang++ crashes when compiling c++ code, after eating all available memory (with -O2 activated).
          </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++
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>David.Tschumperle@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>When trying to compile a minimal version of my project with clang++ (with
option -O2 specified), it eats all the available RAM (4Gb RAM + 4Gb Swap) to
compile a single .cpp file. Without '-O2', the compilation succeeds (in
seconds).

My project is using a lot of template functions, and I suspect this can be
related to this issue (I had similar issues with previous versions of g++ in
the past, that has been fixed, so g++ compiles it flawlessly now).

I attach a .zip file containing the sources to reproduce the problem, as well
as the two output files generated by clang++ (in subfolder 'clang-generated/').
This is what I get when typing 'make' on my machine (ASUS Zenbook 64bits, 4Gb
RAM, running Ubuntu 13.04) :

<span class="quote">>  dtschump@xxxxx:/tmp/gmic_clang$ make
>  clang++ -o gmic gmic.cpp -O2 -Dgmic_build -Dcimg_display=0 -Dgmic_float_only -Dgmic_main -lpthread
>  clang: error: unable to execute command: Killed
>  clang: error: clang frontend command failed due to signal (use -v to see invocation)
>  Ubuntu clang version 3.2-1~exp9ubuntu1 (tags/RELEASE_32/final) (based on LLVM 3.2)
>  Target: x86_64-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:
>  ********************</span >

<span class="quote">>  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/gmic-XLlwLm.cpp
>  clang: note: diagnostic msg: /tmp/gmic-XLlwLm.sh
>  clang: note: diagnostic msg:</span >

<span class="quote">>  ********************
>  make: *** [all] Error 254</span >

The memory usage increases drastically after one minute, until reaching more
than 8Gb. Then it crashes.

This is my first bug report to clang++, I hope all necessary files are here.
Just let me know if you need more information.

Thanks.</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>