riscv target did not handle FUNC_OLD correctly.
Some checks failed
build and test / test-x86_64-linux (push) Has been cancelled
build and test / test-x86_64-osx (push) Has been cancelled
build and test / test-aarch64-osx (push) Has been cancelled
build and test / test-x86_64-win32 (push) Has been cancelled
build and test / test-i386-win32 (push) Has been cancelled
build and test / test-armv7-linux (push) Has been cancelled
build and test / test-aarch64-linux (push) Has been cancelled
build and test / test-riscv64-linux (push) Has been cancelled

This commit is contained in:
herman ten brugge 2025-08-11 06:49:22 +02:00
parent 37e1c88d78
commit 03184fe33b

View File

@ -556,6 +556,7 @@ ST_FUNC void gfunc_call(int nb_args)
int i, align, size, areg[2];
int *info = tcc_malloc((nb_args + 1) * sizeof (int));
int stack_adj = 0, tempspace = 0, stack_add, ofs, splitofs = 0;
int old = (vtop[-nb_args].type.ref->f.func_type == FUNC_OLD);
SValue *sv;
Sym *sa;
@ -583,8 +584,8 @@ ST_FUNC void gfunc_call(int nb_args)
size = align = 8;
byref = 64 | (tempofs << 7);
}
reg_pass(&sv->type, prc, fieldofs, sa != 0);
if (!sa && align == 2*XLEN && size <= 2*XLEN)
reg_pass(&sv->type, prc, fieldofs, old || sa != 0);
if (!old && !sa && align == 2*XLEN && size <= 2*XLEN)
areg[0] = (areg[0] + 1) & ~1;
nregs = prc[0];
if (size == 0)
@ -599,7 +600,7 @@ ST_FUNC void gfunc_call(int nb_args)
if (align < XLEN)
align = XLEN;
stack_adj += (size + align - 1) & -align;
if (!sa) /* one vararg on stack forces the rest on stack */
if (!old && !sa) /* one vararg on stack forces the rest on stack */
areg[0] = 8, areg[1] = 16;
} else {
info[i] = areg[prc[1] - 1]++;