From: Greg King Date: Thu, 31 Dec 2015 22:41:48 +0000 (-0500) Subject: Fixed the cc65 code that handled an addition of a pointer to a 32-bit offset. X-Git-Tag: V2.16~187^2~1 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=7e14dde07b5fb5749b5f58fde3f24069682b3cc6;p=cc65 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. --- 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); - }