http://llvm.org/bugs/show_bug.cgi?id=20569

            Bug ID: 20569
           Summary: Clang miscompiles varargs function when targeting
                    x86_64-pc-win32
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

consider:
#include <assert.h>
#include <stdarg.h>

static const struct S {
  int x[3];
} global = {{1, 2, 3}};

static void f(int arg, ...) {
  va_list ap;
  va_start(ap, arg);

  struct S s = va_arg(ap, struct S);
  assert(global.x[0] == s.x[0]);

  va_end(ap);
}

int main() {
  f(0, global);
  return 0;
}

This test succeeds using gcc, clang and MSVC.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to