History

riscv target did not handle FUNC_OLD correctly.

herman ten brugge committed 1 year ago

Commit 03184fe1 parent 37e1c881 file · +4 −3Browse files

Unified · Split

riscv64-gen.c+4−3
@@ -556,6 +556,7 @@ ST_FUNC void gfunc_call(int nb_args) · 555 unmodified lines
556556 int i, align, size, areg[2];
557557 int *info = tcc_malloc((nb_args + 1) * sizeof (int));
558558 int stack_adj = 0, tempspace = 0, stack_add, ofs, splitofs = 0;
559+ int old = (vtop[-nb_args].type.ref->f.func_type == FUNC_OLD);
559560 SValue *sv;
560561 Sym *sa;
561562
@@ -583,8 +584,8 @@ ST_FUNC void gfunc_call(int nb_args) · 21 unmodified lines
583584 size = align = 8;
584585 byref = 64 | (tempofs << 7);
585586 }
586− reg_pass(&sv->type, prc, fieldofs, sa != 0);
587− if (!sa && align == 2*XLEN && size <= 2*XLEN)
587+ reg_pass(&sv->type, prc, fieldofs, old || sa != 0);
588+ if (!old && !sa && align == 2*XLEN && size <= 2*XLEN)
588589 areg[0] = (areg[0] + 1) & ~1;
589590 nregs = prc[0];
590591 if (size == 0)
@@ -599,7 +600,7 @@ ST_FUNC void gfunc_call(int nb_args) · 8 unmodified lines
599600 if (align < XLEN)
600601 align = XLEN;
601602 stack_adj += (size + align - 1) & -align;
602− if (!sa) /* one vararg on stack forces the rest on stack */
603+ if (!old && !sa) /* one vararg on stack forces the rest on stack */
603604 areg[0] = 8, areg[1] = 16;
604605 } else {
605606 info[i] = areg[prc[1] - 1]++;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t