From 5ce509e30070cd074697c7ba92ce8bae988d378c Mon Sep 17 00:00:00 2001 From: "Vladimir N. Makarov" Date: Fri, 10 May 2024 11:07:49 -0400 Subject: [PATCH] Process special case of anon struct for riscv64 in small_struct_p. --- c2mir/riscv64/criscv64-ABI-code.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/c2mir/riscv64/criscv64-ABI-code.c b/c2mir/riscv64/criscv64-ABI-code.c index 294cd895ac..a12f6aa2cb 100644 --- a/c2mir/riscv64/criscv64-ABI-code.c +++ b/c2mir/riscv64/criscv64-ABI-code.c @@ -69,9 +69,13 @@ static int small_struct_p (c2m_ctx_t c2m_ctx, struct type *type, int struct_only el = NL_NEXT (el)) if (el->code == N_MEMBER) { decl_t decl = el->attr; + mir_size_t member_offset = decl->offset; if (decl->width == 0) continue; - if (!small_struct_p (c2m_ctx, decl->decl_spec.type, FALSE, decl->offset + start_offset, + if (decl->containing_unnamed_anon_struct_union_member != NULL) { + member_offset = 0; + } + if (!small_struct_p (c2m_ctx, decl->decl_spec.type, FALSE, member_offset + start_offset, &sub_n, sub_members)) return FALSE; if (sub_n + *members_n > 2) return FALSE;