<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 - LTO fails with "Called function is not the same type as the call""
   href="https://bugs.llvm.org/show_bug.cgi?id=40312">40312</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>LTO fails with "Called function is not the same type as the call"
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </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>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Interprocedural Optimizations
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>pirama@google.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>This happens with LTO and CFI:

Called function is not the same type as the call!
  tail call void @EC_KEY_free(%struct.ec_key_st* %5) #22, !dbg !33425
in function _ZN9keymaster5EcKey13EvpToInternalEPK11evp_pkey_st
LLVM ERROR: Broken function found, compilation aborted!

The failures are caused by Clang change r335385 (originally landed as r335284)
and LLVM change r335145.

I am attaching lld's repro.tar which can be run as:
  $ tar xvf repro.tar
  $ cd repro
  $ <path-to-lld> @response.txt

The problem is likely in the Clang change as reverting the two changes above
and running the link step doesn't fix the issue.  I am working on narrowing
down the failure to a smaller repro (any tips on doing so with LTO are much
appreciated :)</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>