[Windows] Returning structures from functions has wrong ABI #15928
Labels
bugzilla
Issues migrated from bugzilla
clang:frontend
Language frontend issues, e.g. anything involving "Sema"
Extended Description
Example:
$ cat cl.c
struct S {
int a, b, c;
};
struct S foo(void);
int main(void) {
struct S s = foo();
if (s.a != 1)
return 1;
if (s.b != 2)
return 2;
if (s.c != 3)
return 3;
return 0;
}
int printf(const char *fmt, ...);
void do_something_complex(void) {
printf("%d %d %d %d\n", 1, 2, 3, 4);
}
struct S {
int a, b, c;
};
struct S foo(void) {
struct S ret;
ret.a = 1;
ret.b = 2;
ret.c = 3;
do_something_complex();
return ret;
}
$ cl cl.c clang.c && ./cl.exe; echo $?
-> works fine
As of r177589,
$ clang clang.c -c && cl -c cl.c && link clang.o cl.obj && ./clang.exe ; echo $?
-> Segmentation Fault after the printf.
The text was updated successfully, but these errors were encountered: