C++: Fix indirect global-variable flow#14736
Conversation
…nstead of the index (like we do for non-global uses as well).
… useful in the next commit.
01c5c58 to
39b9d2e
Compare
|
Here's my investigations so far:
to this strncpy that stores to a global: https://github.com/vim/vim/blob/a5a1ec1826c0e43d0282ba4d35c155a97bab3e27/src/option.c#L2088 and then flows to another use of the global here: https://github.com/vim/vim/blob/a5a1ec1826c0e43d0282ba4d35c155a97bab3e27/src/memline.c#L2568 The new ... And the new The new We write to a global variable here:
That global is then used almost immediately by a write to another global Which then taints the The flows all look genuine, so I'm happy with all of these new results 🎉 |
Oops. You're right. The bottom line in that commit should actually have been part of fd26ae1.
I think the commit message is accurate. The commit changes the implementation of For consistency this commit also implements a |
| indirectionIndex = [0 .. defIndex] + 1 | ||
| isDef(_, _, _, vai, indirection, indirectionIndex) |
There was a problem hiding this comment.
The change seems to offset the final argument of isDef by 1, is that correct?
There was a problem hiding this comment.
Correct. So after this change any write to a global variable with indirection index indirectionIndex generates a GlobalUse SSA read at the end of the enclosing function with indirection index indirectionIndex.
jketema
left a comment
There was a problem hiding this comment.
LGTM. Note that I had some 1:1 discussion with @MathiasVP, which clarified most.
C++: Fix indirect global-variable flow




The logic for handling indirections of global variables was all wrong 😭. This PR hopefully fixes this logic 🤞.
The first commit adds a bunch of tests. I've then split the fix into a sequence of small commits. Finally, the last commit accepts the test changes.
There are a couple of new inconsistencies regarding missing
toStringon some esoteric syntax. I haven't investigated those yet, but I don't think they should block this PR.@jketema I'm requesting a review from you because you initially identified these missing steps. Let me know what I can do to help the review process here!