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

DefinitionUseChain doesn't check if a variable is written to in all routes through an if statement. #2760

Open
LonelyCat124 opened this issue Oct 28, 2024 · 0 comments

Comments

@LonelyCat124
Copy link
Collaborator

At the moment if we have code like:

    a = 1
    b = a + c
    if ( d > e) then
        a = 3
    else
        a = 4
    end if
    b = a + d   

Searching for forward accesses from a=1 will find b = a + d (as well as the prior accesses to a. In this case, we could use the knowledge of the code structure to know that a is always written to inside the if statement regardless of the condition result, so b = a + d is never going to use the write from a=1. This is not a bug as it won't cause incorrect code generation for anything we plan to use this from, but it is over-cautious and could be improved in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant