[llvm-bugs] [Bug 40345] New: Function merging pass miscompiles identical vararg functions

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jan 16 18:13:23 PST 2019


https://bugs.llvm.org/show_bug.cgi?id=40345

            Bug ID: 40345
           Summary: Function merging pass miscompiles identical vararg
                    functions
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Interprocedural Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: vsk at apple.com
                CC: llvm-bugs at lists.llvm.org

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 (https://godbolt.org/z/C54W53):

```
; 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
}
```

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190117/5af8eebe/attachment.html>


More information about the llvm-bugs mailing list