-
Notifications
You must be signed in to change notification settings - Fork 4.5k
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
Data flow incorrectly handles out and ref parameters #101734
Labels
area-Tools-ILLink
.NET linker development as well as trimming analyzers
Milestone
Comments
39 tasks
Tagging subscribers to this area: @dotnet/area-system-reflection |
Tagging subscribers to this area: @agocke, @sbomer, @vitek-karas |
michaelgsharp
pushed a commit
to michaelgsharp/runtime
that referenced
this issue
May 9, 2024
And add a testcase to cover IL2068. This just ensures that this particular testcase runs without allowMissingWarnings for the analyzer, and adds one more testcase to track the specific missing warning that was encountered in dotnet#101203 (tracked in dotnet#101734).
Ruihan-Yin
pushed a commit
to Ruihan-Yin/runtime
that referenced
this issue
May 30, 2024
And add a testcase to cover IL2068. This just ensures that this particular testcase runs without allowMissingWarnings for the analyzer, and adds one more testcase to track the specific missing warning that was encountered in dotnet#101203 (tracked in dotnet#101734).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Out parameters should behave like return values in a way - they get assigned a value from within the method body (this works), and they are "read" by the caller (this doesn't work). For example:
The local variable (or stack slot) is not assigned a value after the call to the method with out parameter.
This also means that this doesn't warn:
That's correct, but for a wrong reason - the
typeWithMethods
is tracked throughout the method with anull
literal value, nothing else.But this will warn, twice:
This should not warn at all.
There probably other cases where this is broken. What I can see as two issues:
The second problem applies to ref parameters as well - the value of the variable/stackslot after a call with ref parameter should be an annotated value (pointing to the ref parameter), since the ref parameter acts like an out parameter after the call. On the other hand before the call, the value must be checked as normal in parameter.
The text was updated successfully, but these errors were encountered: