1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-26 05:29:30 +00:00

Fixed a bug

git-svn-id: svn://svn.cc65.org/cc65/trunk@2351 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz 2003-08-17 15:20:18 +00:00
parent aa87296c1f
commit a70d466e3e
2 changed files with 19 additions and 14 deletions

View File

@ -589,9 +589,17 @@ static unsigned FunctionParamList (FuncDesc* Func)
} else {
unsigned ArgSize = sizeofarg (Flags);
if (FrameSize > 0) {
/* We have the space already allocated, store in the frame */
CHECK (FrameSize >= ArgSize);
FrameSize -= ArgSize;
/* We have the space already allocated, store in the frame.
* Because of invalid type conversions (that have produced an
* error before), we can end up here with a non aligned stack
* frame. Since no output will be generated anyway, handle
* these cases gracefully instead of doing a CHECK.
*/
if (FrameSize >= ArgSize) {
FrameSize -= ArgSize;
} else {
FrameSize = 0;
}
FrameOffs -= ArgSize;
/* Store */
g_putlocal (Flags | CF_NOKEEP, FrameOffs, lval.ConstVal);

View File

@ -207,11 +207,10 @@ int TypeConversion (ExprDesc* Expr, int k, type* NewType)
Warning ("Converting pointer to integer without a cast");
} else if (!IsClassInt (Expr->Type)) {
Error ("Incompatible types");
} else {
/* Convert the rhs to the type of the lhs. */
k = DoConversion (Expr, k, NewType);
}
return k;
}
/* Do a conversion regardless of errors and return the result. */
return DoConversion (Expr, k, NewType);
}
/* Handle conversions to pointer type */
@ -228,11 +227,11 @@ int TypeConversion (ExprDesc* Expr, int k, type* NewType)
case TC_INCOMPATIBLE:
Error ("Incompatible pointer types");
return k;
break;
case TC_QUAL_DIFF:
Error ("Pointer types differ in type qualifiers");
return k;
break;
default:
/* Ok */
@ -250,21 +249,19 @@ int TypeConversion (ExprDesc* Expr, int k, type* NewType)
*/
if (TypeCmp (Indirect (NewType), Expr->Type) < TC_EQUAL) {
Error ("Incompatible types");
return k;
}
} else {
Error ("Incompatible types");
return k;
}
/* If we come here, the conversion is ok, convert and return the result */
/* Do the conversion even in case of errors */
return DoConversion (Expr, k, NewType);
}
/* Invalid automatic conversion */
Error ("Incompatible types");
return k;
return DoConversion (Expr, k, NewType);
}