Fied segmentation fault
authorRobert Pengelly <robertapengelly@hotmail.com>
Thu, 25 Jun 2026 22:24:55 +0000 (23:24 +0100)
committerRobert Pengelly <robertapengelly@hotmail.com>
Thu, 25 Jun 2026 22:24:55 +0000 (23:24 +0100)
i386.c
parse.c

diff --git a/i386.c b/i386.c
index f656c2afefe7bae784e81fa9db87e7ab8419826d..cfa55313bde995404c5d8c1725752b854817fa09 100644 (file)
--- a/i386.c
+++ b/i386.c
@@ -18102,6 +18102,8 @@ static void emit_load_assignment_rhs_to_reg (const char *reg) {
             if (tok.kind == TOK_ASSIGN) {
             
                 int lhs_deref_is_unsigned = 1;
+                int lhs_deref_is_aggregate = 0;
+                
                 lhs_sym = find_local_symbol (lhs_name);
                 
                 if (lhs_sym) {
@@ -18110,6 +18112,8 @@ static void emit_load_assignment_rhs_to_reg (const char *reg) {
                         deref_size = DATA_PTR & 0x1f;
                     } else if (lhs_sym->pointer_depth == 1 && lhs_sym->pointed_size > 0) {
                     
+                        lhs_deref_is_aggregate = (lhs_sym->pointed_tag_name != 0);
+                        
                         /**
                          * Keep the full pointed-to object size here.  This
                          * assignment path also handles aggregate lvalues such
@@ -18161,7 +18165,7 @@ static void emit_load_assignment_rhs_to_reg (const char *reg) {
                 
                 get_token ();
                 
-                if (deref_size > (DATA_LLONG & 0x1f)) {
+                if (lhs_deref_is_aggregate || deref_size > (DATA_LLONG & 0x1f)) {
                 
                     emit_pop_reg_now ("edx");
                     
@@ -24087,15 +24091,6 @@ static void emit_load_assignment_rhs_expression_to_reg (const char *reg) {
     int true_label;
     int end_label;
     
-    if (current_expression_mentions_64bit_symbol_now ()) {
-    
-        const char *hi = (strcmp (reg, "edx") == 0) ? "ecx" : "edx";
-        
-        emit_load_assignment_rhs_expression_to_pair (reg, hi, rhs_current_operand_is_unsigned_now ());
-        return;
-    
-    }
-    
     if (rhs_current_operand_is_floating_now ()) {
     
         emit_load_floating_rhs_expression_now (DATA_DOUBLE & 0x1f);
@@ -33563,8 +33558,6 @@ static void parse_statement (void) {
                     
                     } else if (current_function_return_size == (DATA_LLONG & 0x1f)) {
                         emit_load_assignment_rhs_expression_to_pair ("eax", "edx", current_function_return_is_unsigned);
-                    } else if (current_expression_mentions_64bit_symbol_now ()) {
-                        emit_load_assignment_rhs_expression_to_pair ("eax", "edx", current_function_return_is_unsigned);
                     } else {
                         emit_load_assignment_rhs_expression_to_reg ("eax");
                     }
diff --git a/parse.c b/parse.c
index a0e96a257d304da2f36761b78b116d69665a0726..7a8084d0835d463c5351537bacf9626f3450f443 100644 (file)
--- a/parse.c
+++ b/parse.c
@@ -1920,7 +1920,10 @@ int resolve_enum_constant (const char *name, int64_s *out) {
     }
     
     if (out) {
-        *out = entry->value;
+    
+        out->low = entry->value.low;
+        out->high = entry->value.high;
+    
     }
     
     return 1;