Skip to content

Fix failing test valist.c for windows #457

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

Merged
merged 1 commit into from
Feb 26, 2021
Merged

Conversation

john-h-kastner
Copy link
Collaborator

Even though references don't exist in C, va_list is a typedef of
__builtin_va_list & on windows. In order to generate correct constraints
for var arg functions on windows, we need to strip the reference type.

The va_list type on windows seems to use a reference type on windows.
@mattmccutchen-cci
Copy link
Member

Thanks! Where does the reference type come from? Is Clang generating it internally?

Is there a reasonable way to regression-test this on Linux? If not and you have verified that it fixes the problem on Windows, I'll approve.

@john-h-kastner
Copy link
Collaborator Author

This would test the reference problem, but unfortunately exposes a rewriting bug. It looks like __atribute__ breaks rewriting.

void foo( const char *fmt, __builtin_ms_va_list argp);
__attribute__((ms_abi)) void bar ( const char *fmt, ...)  {
  __builtin_ms_va_list argp;
  __builtin_ms_va_start(argp, fmt);
  foo(fmt, argp);
  __builtin_ms_va_end(argp);
}

tests do pass on windows now.

@mattmccutchen-cci
Copy link
Member

This would test the reference problem, but unfortunately exposes a rewriting bug. It looks like __atribute__ breaks rewriting.

Thanks for putting this test case together. We can leave #450 open just to add this regression test once the __attribute__ bug is fixed (which we can also file separately).

tests do pass on windows now.

Great!

@john-h-kastner john-h-kastner merged commit 27e0557 into main Feb 26, 2021
@john-h-kastner john-h-kastner deleted the windows_valist_fix branch March 9, 2021 15:40
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

Successfully merging this pull request may close these issues.

2 participants