Skip to content

clang-cl miscompiles calls to swprintf #21621

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
zmodem opened this issue Oct 11, 2014 · 3 comments
Closed

clang-cl miscompiles calls to swprintf #21621

zmodem opened this issue Oct 11, 2014 · 3 comments
Labels
bugzilla Issues migrated from bugzilla clang Clang issues not falling into any other category

Comments

@zmodem
Copy link
Collaborator

zmodem commented Oct 11, 2014

Bugzilla Link 21247
Resolution FIXED
Resolved on Sep 21, 2015 22:00
Version trunk
OS Windows NT
Blocks #14079 #19261
CC @majnemer,@rnk,@timurrrr

Extended Description

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.

@majnemer
Copy link
Mannequin

majnemer mannequin commented Oct 11, 2014

I wouldn't be surprised if this was caused by _crt_va_start/_crt_va_end mapping to something crazy with clang-cl.

@zmodem
Copy link
Collaborator Author

zmodem commented Oct 15, 2014

r219740

@nico
Copy link
Contributor

nico commented Sep 22, 2015

*** Bug #12534 has been marked as a duplicate of this bug. ***

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 9, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla clang Clang issues not falling into any other category
Projects
None yet
Development

No branches or pull requests

2 participants