rusty
rusty copied to clipboard
Trying to assign to a dereferenced `RValue` panics during codegen
Describe the bug
When trying to assign to a dereferenced pointer which is an RValue (see example below) we currently do not validate against it and will panic during codegen.
To Reproduce Steps to reproduce the behavior:
FUNCTION_BLOCK foo
VAR
x: INT;
END_VAR
(REF(x))^ := 3;
END_FUNCTION_BLOCK
I'm not sure if we should try to fix our codegen to account for such code, similar to *&x = ... in other languages, or validate against this.
An equivalent example in C compiles without problems:
int main()
{
int a = 5;
*(&a) = 10;
}