mirror of
https://github.com/cc65/cc65.git
synced 2025-01-14 00:32:08 +00:00
Fixed a bug that pointer subtraction results from two absolute addresses are calculated as unsigned long.
This commit is contained in:
parent
da4cc08b78
commit
f1c715c455
@ -3353,7 +3353,7 @@ static void parsesub (ExprDesc* Expr)
|
||||
Error ("Incompatible pointer types");
|
||||
} else {
|
||||
Expr->IVal = (Expr->IVal - Expr2.IVal) /
|
||||
CheckedPSizeOf (lhst);
|
||||
(long)CheckedPSizeOf (lhst);
|
||||
}
|
||||
/* Operate on pointers, result type is an integer */
|
||||
Expr->Type = type_int;
|
||||
|
@ -76,6 +76,12 @@ int main (void)
|
||||
fprintf (stderr, "Expected ~32767U == 32768U, got: %ld\n", (long)~32767U);
|
||||
failures++;
|
||||
}
|
||||
|
||||
if ((long*)0x1000 - (long*)0x2000 >= 0) {
|
||||
fprintf (stderr, "Expected (long*)0x1000 - (long*)0x2000 < 0, got: %ld\n", (long*)0x1000 - (long*)0x2000);
|
||||
failures++;
|
||||
}
|
||||
printf ("failures: %u\n", failures);
|
||||
|
||||
return failures;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user