1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-24 11:31:31 +00:00

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.
This commit is contained in:
Greg King 2015-12-31 17:41:48 -05:00
parent 104f898260
commit 7e14dde07b

View File

@ -2390,7 +2390,6 @@ static void parseadd (ExprDesc* Expr)
Type* lhst; /* Type of left hand side */ Type* lhst; /* Type of left hand side */
Type* rhst; /* Type of right hand side */ Type* rhst; /* Type of right hand side */
/* Skip the PLUS token */ /* Skip the PLUS token */
NextToken (); NextToken ();
@ -2573,7 +2572,7 @@ static void parseadd (ExprDesc* Expr)
flags = CF_PTR; flags = CF_PTR;
} else if (IsClassInt (lhst) && IsClassPtr (rhst)) { } else if (IsClassInt (lhst) && IsClassPtr (rhst)) {
/* Left is int, right is pointer, must scale lhs */ /* 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_swap (CF_INT); /* Swap TOS and primary */
g_scale (CF_INT, CheckedPSizeOf (rhst)); g_scale (CF_INT, CheckedPSizeOf (rhst));
/* Operate on pointers, result type is a pointer */ /* Operate on pointers, result type is a pointer */
@ -2607,7 +2606,6 @@ static void parseadd (ExprDesc* Expr)
/* Condition codes not set */ /* Condition codes not set */
ED_MarkAsUntested (Expr); ED_MarkAsUntested (Expr);
} }