Fix arm64-gen.c when passing a struct ptr to va_arg.

This commit is contained in:
Christian Jullien 2020-03-22 08:26:03 +01:00
parent 6fa78a3635
commit ec0e93616f
2 changed files with 18 additions and 2 deletions

View File

@ -242,17 +242,22 @@ ST_FUNC void gsym_addr(int t_, int a_)
static int arm64_type_size(int t)
{
/*
* case values are in increasing order (from 1 to 11).
* which 'may' help compiler optimizers. See tcc.h
*/
switch (t & VT_BTYPE) {
case VT_INT: return 2;
case VT_BYTE: return 0;
case VT_SHORT: return 1;
case VT_INT: return 2;
case VT_LLONG: return 3;
case VT_PTR: return 3;
case VT_FUNC: return 3;
case VT_STRUCT: return 3;
case VT_FLOAT: return 2;
case VT_DOUBLE: return 3;
case VT_LDOUBLE: return 4;
case VT_BOOL: return 0;
case VT_LLONG: return 3;
}
assert(0);
return 0;

View File

@ -230,6 +230,17 @@ void ret(void)
printf("%.1Lf %.1Lf\n", fr_hfa34().a, fr_hfa34().d);
}
void*
va_arg_with_struct_ptr(va_list ap) {
/*
* This was a BUG identified with FFTW-3.3.8 on arm64.
* The test case only checks it compiles.
*/
struct X { int _x; };
struct X *x = va_arg(ap, struct X *);
return x;
}
int match(const char **s, const char *f)
{
const char *p = *s;