Fix division-by-zero checks on a /= 0 and b /= 0f #2558.

This commit is contained in:
Christoffer Lerno
2025-11-03 21:31:47 +01:00
parent 791cbbfb62
commit d43d7100af
2 changed files with 2 additions and 3 deletions

View File

@@ -12,6 +12,7 @@
- `Foo.is_eq` would return false if the type was a `typedef` and had an overload, but the underlying type was not comparable.
- Remove division-by-zero checks for floating point in safe mode #2556.
- Fix division-by-zero checks on `a /= 0` and `b /= 0f` #2558.
- Fix fmod `a %= 0f`.
### Stdlib changes

View File

@@ -7166,6 +7166,7 @@ static bool sema_expr_analyse_op_assign(SemaContext *context, Expr *expr, Expr *
{
case BINARYOP_MULT_ASSIGN:
case BINARYOP_DIV_ASSIGN:
case BINARYOP_MOD_ASSIGN:
break;
case BINARYOP_BIT_AND_ASSIGN:
case BINARYOP_BIT_OR_ASSIGN:
@@ -7177,9 +7178,6 @@ static bool sema_expr_analyse_op_assign(SemaContext *context, Expr *expr, Expr *
case BINARYOP_SUB_ASSIGN:
is_add_sub = true;
break;
case BINARYOP_MOD_ASSIGN:
int_only = true;
break;
case BINARYOP_SHL_ASSIGN:
case BINARYOP_SHR_ASSIGN:
is_shift = true;