Skip to content

MSYS2 clang va_start is broken #2291

@easyaspi314

Description

@easyaspi314

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions