<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 --- - "internal compiler error: Segmentation fault" on C++ code"
   href="http://llvm.org/bugs/show_bug.cgi?id=18358">18358</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>"internal compiler error: Segmentation fault" on C++ code
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>dragonegg
          </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>baldrick@free.fr
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>scott+llvm+bugzilla@pakin.org
          </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=11804" name="attach_11804" title="Small C++ file that crashes DragonEgg">attachment 11804</a> <a href="attachment.cgi?id=11804&action=edit" title="Small C++ file that crashes DragonEgg">[details]</a></span>
Small C++ file that crashes DragonEgg

The attached reproducer (dregg-seg.cpp) causes g++ to abort with an "internal
compiler error: Segmentation fault" in DragonEgg.  Here are the version numbers
of relevant programs:

  * DragonEgg/LLVM r198359
  * g++ (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
  * Linux morbo 3.11.0-14-generic

The following gdb session shows how to reproduce the error and where in the
code the segmentation fault occurs:

    $ gdb --args /usr/bin/g++ -g -O2 -std=c++11 dregg-seg.cpp -o dregg-seg.ll
-S -fplugin=/tmp/byfl-install/lib/dragonegg.so -fplugin-arg-dragonegg-emit-ir 
    GNU gdb (GDB) 7.6.1-ubuntu
    Copyright (C) 2013 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later
<<a href="http://gnu.org/licenses/gpl.html">http://gnu.org/licenses/gpl.html</a>>
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
    and "show warranty" for details.
    This GDB was configured as "x86_64-linux-gnu".
    For bug reporting instructions, please see:
    <<a href="http://www.gnu.org/software/gdb/bugs/">http://www.gnu.org/software/gdb/bugs/</a>>...
    Reading symbols from /usr/bin/g++-4.8...(no debugging symbols
found)...done.
    (gdb) set follow-fork-mode child
    (gdb) run
    Starting program: /usr/bin/g++ -g -O2 -std=c++11 dregg-seg.cpp -o
dregg-seg.ll -S -fplugin=/tmp/byfl-install/lib/dragonegg.so
-fplugin-arg-dragonegg-emit-ir
    [New process 2218]
    process 2218 is executing new program:
/usr/lib/gcc/x86_64-linux-gnu/4.8/cc1plus
    Warning: couldn't activate thread debugging using libthread_db: Cannot find
new threads: generic error
    Warning: couldn't activate thread debugging using libthread_db: Cannot find
new threads: generic error
    warning: Unable to find libthread_db matching inferior's thread library,
thread debugging will not be available.

    Program received signal SIGSEGV, Segmentation fault.
    [Switching to process 2218]
    llvm::TypeFinder::incorporateType (this=this@entry=0x7fffffffde28,
Ty=<optimized out>) at TypeFinder.cpp:115
    115          if (VisitedTypes.insert(*I).second)
    (gdb) backtrace
    #0  llvm::TypeFinder::incorporateType (this=this@entry=0x7fffffffde28,
Ty=<optimized out>) at TypeFinder.cpp:115
    #1  0x00007ffff604137e in llvm::TypeFinder::run
(this=this@entry=0x7fffffffde28, M=..., onlyNamed=onlyNamed@entry=false) at
TypeFinder.cpp:45
    #2  0x00007ffff5f7d5a8 in llvm::TypePrinting::incorporateTypes
(this=0x7fffffffde28, M=...) at AsmWriter.cpp:169
    #3  0x00007ffff5f878f8 in llvm::Module::print (this=this@entry=0x15e5580,
ROS=..., AAW=AAW@entry=0x0) at AsmWriter.cpp:2135
    #4  0x00007ffff6038e22 in operator<< (M=..., O=...) at
/tmp/byfl-build/llvm/include/llvm/IR/Module.h:591
    #5  (anonymous namespace)::PrintModulePass::runOnModule (this=<optimized
out>, M=...) at PrintModulePass.cpp:40
    #6  0x00007ffff602f6f5 in runOnModule (M=..., this=<optimized out>) at
LegacyPassManager.cpp:1616
    #7  llvm::legacy::PassManagerImpl::run (this=0x16670a0, M=...) at
LegacyPassManager.cpp:1711
    #8  0x00007ffff57b7592 in llvm_finish_unit () at
/tmp/byfl-build/dragonegg/src/Backend.cpp:1967
    #9  0x000000000084e93a in invoke_plugin_callbacks_full(int, void*) ()
    #10 0x00000000008dc474 in ?? ()
    #11 0x00000000008ddcda in toplev_main(int, char**) ()
    #12 0x00007ffff69fbde5 in __libc_start_main (main=0x51c470 <main>, argc=25,
ubp_av=0x7fffffffe1f8, init=<optimized out>, fini=<optimized out>,
rtld_fini=<optimized out>, 
    stack_end=0x7fffffffe1e8) at libc-start.c:260
    #13 0x000000000051c6df in _start ()

The segfault goes away if "-O2" and/or "-fplugin-arg-dragonegg-emit-ir" is
omitted from the command line.

Regards,
-- Scott

P.S.  The reproducer is a heavily trimmed version of my Byfl tool.  See
<a href="https://github.com/losalamos/Byfl">https://github.com/losalamos/Byfl</a> for the complete source code if you want
further DragonEgg stress-testing.</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>