PLC-lang / rusty

Structured Text Parser and LLVM Frontend
GNU Lesser General Public License v3.0
204 stars 52 forks source link

allow (automatic?) pointer casts as seen in oscat #463

Closed riederm closed 2 years ago

riederm commented 2 years ago

Describe the bug allow assignments between different pointer-types:

e.g.

VAR
   pt : REF_TO DWORD;
   x : REAL;
END_VAR

pt := &x;   // POINTER TO DWORD := POINTER TO REAL

We should allow the assignment, but at least warn, especially if you use a pointer-type that is bigger than the target: e.g.

VAR
   pt : REF_TO DWORD;
   x : BYTE;
END_VAR

pt := &x;   // POINTER TO DWORD := POINTER TO BYTE --> this smells bad!

Additional context seen in oscat: e,g,

FUNCTION TEMP_PT : REAL
create-issue-branch[bot] commented 2 years ago

Branch issue-463-allow_automatic_pointer_casts_as_seen_in_oscat created!