} 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);
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 */
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 */
*/
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);
}