From 41019f50533d0c5ceeb1499c0ec857e7bc898502 Mon Sep 17 00:00:00 2001 From: Robert Pengelly Date: Thu, 17 Sep 2026 08:02:00 +0100 Subject: [PATCH] Fix member access through function call results --- amd64.c | 8 ++++++++ i386.c | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/amd64.c b/amd64.c index 233a027..e2f07d8 100644 --- a/amd64.c +++ b/amd64.c @@ -22067,6 +22067,14 @@ static void emit_load_assignment_rhs_to_reg (const char *reg) { emit_call_identifier_to_reg_now (name, reg, name_start, name_caret, name_line); + /* + * A postfix member chain after a function call starts from the + * function's pointed-to type. Do not leave the member walker + * using stale metadata from an earlier expression. + */ + postfix_copy_lvalue_size = get_global_symbol_pointed_size (name); + postfix_copy_lvalue_tag_name = get_global_symbol_tag_name (name); + if (tok.kind == TOK_LBRACK) { int subscript_pointer_depth = get_global_symbol_pointer_depth (name); diff --git a/i386.c b/i386.c index 07cdc53..f9e9334 100644 --- a/i386.c +++ b/i386.c @@ -20742,6 +20742,14 @@ static void emit_load_assignment_rhs_to_reg (const char *reg) { emit_call_identifier_to_reg_now (name, reg, name_start, name_caret, name_line); + /* + * A postfix member chain after a function call starts from the + * function's pointed-to type. Do not leave the member walker + * using stale metadata from an earlier expression. + */ + postfix_copy_lvalue_size = get_global_symbol_pointed_size (name); + postfix_copy_lvalue_tag_name = get_global_symbol_tag_name (name); + if (tok.kind == TOK_LBRACK) { int subscript_pointer_depth = get_global_symbol_pointer_depth (name); -- 2.34.1