Skip to content
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

unreachable!() reached when trying to assign a void call result to a pointer #905

Open
mhasel opened this issue Jul 13, 2023 · 0 comments
Open
Labels
bug Something isn't working

Comments

@mhasel
Copy link
Member

mhasel commented Jul 13, 2023

When trying to run the following code, the compiler hits an unreachable in llvm_typesystem::cast_if_needed without a validation error being reported:

FUNCTION_BLOCK fb_t
VAR_INPUT
    x : DINT;
END_VAR
END_FUNCTION_BLOCK

FUNCTION main : DINT
VAR
    fb : fb_t;
    y : STRING := 'hello';
END_VAR
    fb := fb(1); // panics
    y := fb(1); // panics
END_FUNCTION

We should add a validation to catch assignments to pointers, where the RHS is void.

@mhasel mhasel added the bug Something isn't working label Jul 13, 2023
@mhasel mhasel changed the title Unreachable panic when trying to assign a function block call to its pointer unreachable!() reached when trying to assign a function block call to its pointer Jul 13, 2023
@mhasel mhasel changed the title unreachable!() reached when trying to assign a function block call to its pointer unreachable!() reached when trying to assign a void call result to a pointer Jul 13, 2023
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

No branches or pull requests

1 participant