rusty
rusty copied to clipboard
Division by const 0 should be an error
Is your feature request related to a problem? Please describe. Currently, the following code compiles without warning/error:
FUNCTION foo: DINT
foo := 1 / 0;
END_FUNCTION
Describe the solution you'd like
We already mark expressions with zero on the right as unresolvable in const_evaluator.rs but don't report it. We should introduce a diagnostic, similar to the overflow-error, and warn the user that the expression will cause a runtime crash.