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

Fix flow analysis to stop tracking entities which have unknown instance location #6466

Merged
merged 1 commit into from
Feb 1, 2023

Conversation

mavasani
Copy link
Contributor

Fixes #6453
While performing flow analysis for loops, we clear out the instance location for analysis entities when processing the back edges. This is primarily done because same operation when processed again might refer to a different runtime object/entity for a different loop iteration, and we have no way to known if any members accessed of this object point to the same runtime instance. Even though we were correctly setting the instance location for such entities to Unknown location on back edges, we were still continuining to track the analysis data for such entities. This led to multiple such distinct entities being considered identical and sharing the same flow analysis values, as seen in the bug repro case.

The fix here is to avoid tracking such child or instance member entities which have an unknown instance location for flow analysis.

…ce location

Fixes dotnet#6453
While performing flow analysis for loops, we clear out the instance location for analysis entities when processing the back edges. This is primarily done because same operation when processed again might refer to a different runtime object/entity for a different loop iteration, and we have no way to known if any members accessed of this object point to the same runtime instance. Even though we were correctly setting the instance location for such entities to Unknown location on back edges, we were still continuining to track the analysis data for such entities. This led to multiple such distinct entities being considered identical and sharing the same flow analysis values, as seen in the bug repro case.

The fix here is to avoid tracking such child or instance member entities which have an unknown instance location for flow analysis.
@mavasani mavasani requested a review from a team as a code owner January 31, 2023 13:28
@mavasani
Copy link
Contributor Author

@Youssef1313 @Evangelink for reviews

Copy link
Member

@Youssef1313 Youssef1313 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not very familiar with DFA, but assuming all tests pass, LGTM.

@codecov
Copy link

codecov bot commented Jan 31, 2023

Codecov Report

Merging #6466 (bfcbf20) into main (e516933) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Additional details and impacted files
@@           Coverage Diff            @@
##             main    #6466    +/-   ##
========================================
  Coverage   96.15%   96.15%            
========================================
  Files        1374     1374            
  Lines      318826   319075   +249     
  Branches    10332    10333     +1     
========================================
+ Hits       306553   306800   +247     
- Misses       9818     9821     +3     
+ Partials     2455     2454     -1     

@mavasani
Copy link
Contributor Author

Not very familiar with DFA, but assuming all tests pass, LGTM.

Thanks @Youssef1313

@mavasani mavasani merged commit a25bf53 into dotnet:main Feb 1, 2023
@mavasani mavasani deleted the Fix6453 branch February 1, 2023 03:17
@github-actions github-actions bot added this to the vNext milestone Feb 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CA1508 false positive in for loop removing items from List
2 participants