rusty icon indicating copy to clipboard operation
rusty copied to clipboard

Overflow checks in bodies are missing

Open volsa opened this issue 1 year ago • 0 comments

Is your feature request related to a problem? Please describe. The following code

FUNCTION main : DINT
    VAR
        x : SINT := 1000000;
    END_VAR
        x := 1000000;
END_FUNCTION

will return an overflow error for the assignment in the VAR-block, but not for the assignment in the implementation / body. Specficially when compiling the code we get the following output

warning: This will overflow for type SINT
  ┌─ target/demo.st:3:21
  │
3 │         x : SINT := 1000000;
  │                     ^^^^^^^ This will overflow for type SINT

but the one in the body is missing.

Describe the solution you'd like Check overflows (where possible) in the body

volsa avatar Mar 06 '24 12:03 volsa