mirror of
https://github.com/cc65/cc65.git
synced 2025-01-11 11:30:13 +00:00
Fixed ICE on error cases such as '&func + int a'.
This commit is contained in:
parent
200b420562
commit
91fd30611a
@ -2850,27 +2850,31 @@ static void parseadd (ExprDesc* Expr, int DoArrayRef)
|
|||||||
} else {
|
} else {
|
||||||
/* OOPS */
|
/* OOPS */
|
||||||
AddDone = -1;
|
AddDone = -1;
|
||||||
|
/* Avoid further errors */
|
||||||
|
ED_MakeConstAbsInt (Expr, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Do constant calculation if we can */
|
if (!AddDone) {
|
||||||
if (ED_IsAbs (&Expr2) &&
|
/* Do constant calculation if we can */
|
||||||
(ED_IsAbs (Expr) || lscale == 1)) {
|
if (ED_IsAbs (&Expr2) &&
|
||||||
if (IsClassInt (lhst) && IsClassInt (rhst)) {
|
(ED_IsAbs (Expr) || lscale == 1)) {
|
||||||
Expr->Type = ArithmeticConvert (Expr->Type, Expr2.Type);
|
if (IsClassInt (lhst) && IsClassInt (rhst)) {
|
||||||
|
Expr->Type = ArithmeticConvert (Expr->Type, Expr2.Type);
|
||||||
|
}
|
||||||
|
Expr->IVal = Expr->IVal * lscale + Expr2.IVal * rscale;
|
||||||
|
AddDone = 1;
|
||||||
|
} else if (ED_IsAbs (Expr) &&
|
||||||
|
(ED_IsAbs (&Expr2) || rscale == 1)) {
|
||||||
|
if (IsClassInt (lhst) && IsClassInt (rhst)) {
|
||||||
|
Expr2.Type = ArithmeticConvert (Expr2.Type, Expr->Type);
|
||||||
|
}
|
||||||
|
Expr2.IVal = Expr->IVal * lscale + Expr2.IVal * rscale;
|
||||||
|
/* Adjust the flags */
|
||||||
|
Expr2.Flags |= Expr->Flags & ~E_MASK_KEEP_SUBEXPR;
|
||||||
|
/* Get the symbol and the name */
|
||||||
|
*Expr = Expr2;
|
||||||
|
AddDone = 1;
|
||||||
}
|
}
|
||||||
Expr->IVal = Expr->IVal * lscale + Expr2.IVal * rscale;
|
|
||||||
AddDone = 1;
|
|
||||||
} else if (ED_IsAbs (Expr) &&
|
|
||||||
(ED_IsAbs (&Expr2) || rscale == 1)) {
|
|
||||||
if (IsClassInt (lhst) && IsClassInt (rhst)) {
|
|
||||||
Expr2.Type = ArithmeticConvert (Expr2.Type, Expr->Type);
|
|
||||||
}
|
|
||||||
Expr2.IVal = Expr->IVal * lscale + Expr2.IVal * rscale;
|
|
||||||
/* Adjust the flags */
|
|
||||||
Expr2.Flags |= Expr->Flags & ~E_MASK_KEEP_SUBEXPR;
|
|
||||||
/* Get the symbol and the name */
|
|
||||||
*Expr = Expr2;
|
|
||||||
AddDone = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AddDone) {
|
if (AddDone) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user