amd64: Preserve cast signedness in arithmetic expressions
authorRobert Pengelly <robertapengelly@hotmail.com>
Sun, 15 Nov 2026 22:20:37 +0000 (22:20 +0000)
committerRobert Pengelly <robertapengelly@hotmail.com>
Sun, 15 Nov 2026 22:20:37 +0000 (22:20 +0000)
amd64.c

diff --git a/amd64.c b/amd64.c
index 47b54763c3393f8f7fda759c3f737ba6ca153239..8ed68af71d17d646bb03fac1b5ec109998ce8015 100644 (file)
--- a/amd64.c
+++ b/amd64.c
@@ -28417,8 +28417,14 @@ static int emit_load_assignment_binary_expression_prec_to_reg (const char *reg,
     int expr_pointed_size;
     
     is_unsigned = rhs_current_operand_is_unsigned_now ();
+    rhs_last_explicit_integer_cast_signedness = -1;
+    
     emit_load_assignment_rhs_to_reg (reg);
     
+    if (rhs_last_explicit_integer_cast_signedness >= 0) {
+        is_unsigned = rhs_last_explicit_integer_cast_signedness;
+    }
+    
     /*
      * Some statement-condition paths can leave a postfix member chain after
      * the primary operand, e.g. inside parenthesized logical RHS terms such as