<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - Fibonacci example segfault"
   href="https://bugs.llvm.org/show_bug.cgi?id=33309">33309</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Fibonacci example segfault
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>4.0
          </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>Core LLVM classes
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>lodovico@giaretart.net
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I'm on ArchLinux x86_64

  > uname -a
  Linux <username> 4.11.3-1-ARCH #1 SMP PREEMPT Sun May 28 10:40:17 CEST 2017
x86_64 GNU/Linux

  > llvm-config --version
  4.4.0

I'm compiling the Fibonacci example downloaded from the GitHub mirror at [1]
this way (I'm using the fish shell):

  > eval g++ -g3 (llvm-config --cxxflags --ldflags --libs) fib.cpp

It compiles fine (just one warning about a missing sentinel, which is actually
present), but it segfaults. This is the stack trace reported by gdb:

  #0 llvm::Value::getContext() const () from /usr/lib/LLVM-4.0.so
  #1 llvm::Value::setNameImpl(llvm::Twine const&) () from /usr/lib/LLVM-4.0.so
  #2 llvm::Value::setName(llvm::Twine const&) () from /usr/lib/LLVM-4.0.so
  #3 llvm::Function::BuildLazyArguments() const () from /usr/lib/LLVM-4.0.so
  #4 llvm::Function::CheckLazyArguments (this=<optimized out>) at
/usr/include/llvm/IR/Function.h:100
  #5 llvm::Function:arg_begin (this=<optimized out>) at
/usr/include/llvm/IR/Function:551
  #6 CreateFibFunction (Context=..., M=0x632370) at fib.cpp:67
  #7 main (argc=<optimized out>, argv=0x7fffffffe608) at fib.cpp:114


[1]
<a href="https://raw.githubusercontent.com/llvm-mirror/llvm/release_40/examples/Fibonacci/fibonacci.cpp">https://raw.githubusercontent.com/llvm-mirror/llvm/release_40/examples/Fibonacci/fibonacci.cpp</a></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>