Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/core/stdc/stdarg.d
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,14 @@ T va_arg(T)(ref va_list ap)
}
else version (RISCV_Any)
{
auto p = cast(T*) ap;
static if (T.sizeof > (size_t.sizeof << 1))
auto p = *cast(T**) ap;
else
{
static if (T.alignof == (size_t.sizeof << 1))
ap = ap.alignUp!(size_t.sizeof << 1);
auto p = cast(T*) ap;
}
ap += T.sizeof.alignUp;
return *p;
}
Expand Down
10 changes: 9 additions & 1 deletion src/core/vararg.d
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,15 @@ void va_arg()(ref va_list ap, TypeInfo ti, void* parmn)
else version (RISCV_Any)
{
const tsize = ti.tsize;
auto p = cast(void*) ap;
void* p;
if (tsize > (size_t.sizeof << 1))
p = *cast(void**) ap;
else
{
if (tsize == (size_t.sizeof << 1))
ap = ap.alignUp!(size_t.sizeof << 1);
p = cast(void*) ap;
}
ap += tsize.alignUp;
parmn[0..tsize] = p[0..tsize];
}
Expand Down