Skip to content

Commit 5ce509e

Browse files
committed
Process special case of anon struct for riscv64 in small_struct_p.
1 parent 62c4ece commit 5ce509e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

c2mir/riscv64/criscv64-ABI-code.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,13 @@ static int small_struct_p (c2m_ctx_t c2m_ctx, struct type *type, int struct_only
6969
el = NL_NEXT (el))
7070
if (el->code == N_MEMBER) {
7171
decl_t decl = el->attr;
72+
mir_size_t member_offset = decl->offset;
7273

7374
if (decl->width == 0) continue;
74-
if (!small_struct_p (c2m_ctx, decl->decl_spec.type, FALSE, decl->offset + start_offset,
75+
if (decl->containing_unnamed_anon_struct_union_member != NULL) {
76+
member_offset = 0;
77+
}
78+
if (!small_struct_p (c2m_ctx, decl->decl_spec.type, FALSE, member_offset + start_offset,
7579
&sub_n, sub_members))
7680
return FALSE;
7781
if (sub_n + *members_n > 2) return FALSE;

0 commit comments

Comments
 (0)