<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 - Function merging pass miscompiles identical vararg functions"
   href="https://bugs.llvm.org/show_bug.cgi?id=40345">40345</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Function merging pass miscompiles identical vararg functions
          </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>All
          </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>Interprocedural Optimizations
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>vsk@apple.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Example:

```
#include <stdarg.h>

void escape(int);

void simple_va(const char* fmt, ...)
{
    va_list args;
    va_start(args, fmt);
    int i = va_arg(args, int);
    escape(i);
    va_end(args);
}

void simple_va2(const char* fmt, ...)
{
    va_list args;
    va_start(args, fmt);
    int i = va_arg(args, int);
    escape(i);
    va_end(args);
}
```

Clang emits (<a href="https://godbolt.org/z/C54W53">https://godbolt.org/z/C54W53</a>):

```
; Function Attrs: minsize optsize uwtable
define dso_local void @_Z9simple_vaPKcz(i8* nocapture readnone, ...)
local_unnamed_addr #3 {
  tail call void (i8*, ...) @_Z10simple_va2PKcz(i8* nocapture readnone %0) #3
  ret void
}
```</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>