Skip to content

Cryptic codegen error when trying to assign boolean VAR_OUTPUT to specific bit of BYTE variable #1176

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mhasel opened this issue Mar 26, 2024 · 0 comments · Fixed by #1214
Closed
Labels
bug Something isn't working

Comments

@mhasel
Copy link
Member

mhasel commented Mar 26, 2024

Describe the bug
Writing a boolean value returned from a VAR_OUTPUT block into a bit-accessed bit will result in an error during codegen:

error[E071]: ()
   ┌─ target/demo.st:55:12
   │
55 │     f(Q => error_bits.0);
   │            ^^^^^^^^^^^^ ()

Error: Compilation aborted due to previous errors.

To Reproduce

FUNCTION_BLOCK FOO
VAR_OUTPUT 
    Q : BOOL;
END_VAR
END_FUNCTION_BLOCK

FUNCTION main : DINT 
VAR
    error_bits : BYTE;
    f : FOO;
END_VAR
    f(Q => error_bits.0);
END_FUNCTION

Expected behavior
The access bit of error_bits should have the value of f.Q after the call.

Additional context
A similar example with TON was found in a test project.

@mhasel mhasel added the bug Something isn't working label Mar 26, 2024
@mhasel mhasel changed the title Cryptic codegen error when trying to assign boolean 'VAR_OUTPUT to specific bit of BYTE` variable Cryptic codegen error when trying to assign boolean VAR_OUTPUT to specific bit of BYTE variable Mar 26, 2024
volsa added a commit that referenced this issue Jun 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant