Skip to content
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

MSYS2 clang va_start is broken #2291

Open
easyaspi314 opened this issue Dec 29, 2020 · 4 comments
Open

MSYS2 clang va_start is broken #2291

easyaspi314 opened this issue Dec 29, 2020 · 4 comments

Comments

@easyaspi314
Copy link

easyaspi314 commented Dec 29, 2020

Describe the issue

MSYS2 Clang miscompiles va_start.

Steps to Reproduce the Problem

  1. Compile this file with Clang in MSYS2. Optimizations neither break nor fix the issue.
#include <stdarg.h>
#include <stdio.h>

void my_printf(const char *fmt, ...)
{
    va_list ap;
    va_start(ap, fmt);
    vprintf(fmt, ap);
    va_end(ap);
}

int main(void)
{
    my_printf("%s\n", "Hello, world!");
}
  1. Run it.
  2. Garbage is outputted to the console.
  3. Note that GCC compiles it fine, so it is not a libc problem.

Additional Context: Operating System, Screenshots

$ clang -v
clang version 11.0.0 (https://github.com/msys2/MSYS2-packages a5a028a0811f03c8f9697bf80c2e28111628ffff)
Target: x86_64-pc-windows-msys
Thread model: posix
InstalledDir: /usr/bin

Also reported here at LLVM: https://bugs.llvm.org/show_bug.cgi?id=48624

@mati865
Copy link
Collaborator

mati865 commented Dec 29, 2020

MSYS2 is not officially supported Clang target, I'd expect many more issues here.

@wader
Copy link

wader commented Jun 27, 2023

@easyaspi314 thanks for the issue, was going crazy debugging this for a program

@Biswa96
Copy link
Member

Biswa96 commented Jun 27, 2023

Is there any reason not to use mingw clang compiler?

@wader
Copy link

wader commented Jun 27, 2023

@Biswa96 no reason, someone picked msys2 years ago and now we had switch to use clang for all cross builds and things broke. so i guess we have to go for msys2 and gcc or mingw clang for windows

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants