[LLVMbugs] [Bug 21247] New: clang-cl miscompiles calls to wsprintf

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Oct 10 16:58:03 PDT 2014


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

            Bug ID: 21247
           Summary: clang-cl miscompiles calls to wsprintf
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: hans at chromium.org
                CC: llvmbugs at cs.uiuc.edu
            Blocks: 13707, 18887
    Classification: Unclassified

Consider:

  #include <stdio.h>

  int main() {
    wchar_t buf[1024];

    swprintf(buf, 1024, L"hello %d\n", 42);
    printf("%ws\n", buf);

    return 0;
  }

Compiled with clang-cl, the program prints garbage (debug mode) or 0
(optimized).

Note that this happens when we hit the inline definition of swprintf in
VC/include/swprinf.inl, which gets included from stdio.h.

-- 
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/20141010/187c535b/attachment.html>


More information about the llvm-bugs mailing list