From 7e14dde07b5fb5749b5f58fde3f24069682b3cc6 Mon Sep 17 00:00:00 2001 From: Greg King Date: Thu, 31 Dec 2015 17:41:48 -0500 Subject: [PATCH] Fixed the cc65 code that handled an addition of a pointer to a 32-bit offset. It didn't demote the offset to int because it looked at the pointer (instead of the offset) which already was 16 bits. --- src/cc65/expr.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/cc65/expr.c b/src/cc65/expr.c index 29e5771d4..34cf550a2 100644 --- a/src/cc65/expr.c +++ b/src/cc65/expr.c @@ -2390,7 +2390,6 @@ static void parseadd (ExprDesc* Expr) Type* lhst; /* Type of left hand side */ Type* rhst; /* Type of right hand side */ - /* Skip the PLUS token */ NextToken (); @@ -2573,7 +2572,7 @@ static void parseadd (ExprDesc* Expr) flags = CF_PTR; } else if (IsClassInt (lhst) && IsClassPtr (rhst)) { /* Left is int, right is pointer, must scale lhs */ - g_tosint (TypeOf (rhst)); /* Make sure, TOS is int */ + g_tosint (TypeOf (lhst)); /* Make sure TOS is int */ g_swap (CF_INT); /* Swap TOS and primary */ g_scale (CF_INT, CheckedPSizeOf (rhst)); /* Operate on pointers, result type is a pointer */ @@ -2607,7 +2606,6 @@ static void parseadd (ExprDesc* Expr) /* Condition codes not set */ ED_MarkAsUntested (Expr); - } -- 2.39.5