Warnings instead of errors for division-by-zero/modulo-with-zero in evaluation.

This commit is contained in:
acqn
2022-11-12 22:13:56 +08:00
parent cc177208b4
commit 9d693d2c80
2 changed files with 8 additions and 8 deletions

View File

@@ -319,9 +319,9 @@ static void OpAssignBitField (const GenDesc* Gen, ExprDesc* Expr, const char* Op
if (Expr2.IVal == 0) {
/* Check for div by zero/mod by zero */
if (Gen->Func == g_div) {
Error ("Division by zero");
Warning ("Division by zero");
} else if (Gen->Func == g_mod) {
Error ("Modulo operation with zero");
Warning ("Modulo operation with zero");
}
} else if (Gen->Func == g_asl || Gen->Func == g_asr) {
const Type* CalType = IntPromotion (Expr->Type);
@@ -528,9 +528,9 @@ static void OpAssignArithmetic (const GenDesc* Gen, ExprDesc* Expr, const char*
if (Expr2.IVal == 0 && !ED_IsUneval (Expr)) {
/* Check for div by zero/mod by zero */
if (Gen->Func == g_div) {
Error ("Division by zero");
Warning ("Division by zero");
} else if (Gen->Func == g_mod) {
Error ("Modulo operation with zero");
Warning ("Modulo operation with zero");
}
} else if (Gen->Func == g_asl || Gen->Func == g_asr) {
const Type* CalType = IntPromotion (Expr->Type);