-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix the dependency issue when using SSA variables #2719
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
base: dev
Are you sure you want to change the base?
Conversation
Hi, it should be due to the warnings you see in the screenshot. If you run |
Hi, I have run this locally, I have the following output, and no such warnings are shown.
Only the last several lines are related to my changed code and they should not cause the workflow to fail. |
I have done the refactor on the code, and there should be no more linter issues. |
Hi @smonicas, can we proceed to the CI/CD workflows? I have fixed the previous problems and it should work now. |
…a_dependency/data_dependency.py
…ependency/data_dependency.py
Hi Maintainers, It seems that all the checks are passed. Is it possible to merge the PR or I need to make further changes? |
What is happening in the previous version
If I'm using Slither to analyze the above code, the SSA variables will be generated for the parameter
from
inslither/slithir/utils/ssa.py
line 127-135 and 162-172:In this case, even a parameter is never written in a function, it will have two SSA variable, one is for the parameter (in the given case is
from_0
), and another for the usage (from_1
).When building the data dependency of SSA variables in
slither/analyses/data_dependency/data_dependency.py
, functioncompute_dependency_function
, it will not consider such dependency. Sofrom_1
will not have dependency withfrom_0
, which is wrong.How I solved this
I added some code into
slither/analyses/data_dependency/data_dependency.py
, functioncompute_dependency_function
. When a function is analyzed, I will record all the SSA variables that are never written (used as lvalue) but used (as rvalue). If these variables' non-ssa version is the same with parameters, I will add a dependency edge between them.The new test case is provided a proof-of-concept.