Skip to content

Data flow doesn't track per-branch values correctly #117157

@vitek-karas

Description

@vitek-karas
			string str = GetWithPublicMethods ();
			if (String.Empty.Length == 0) {
				str = GetWithPublicFields (); // dataflow will merge this with the value from the previous basic block
				RequirePublicFields (str); // produces a warning
			}

In the above sample, at the point of calling RequirePublicFields the str local is guaranteed to have the value coming only from GetWithPublicFields(), so it should not warn. But linker doesn't correctly track the values in this case.

There is an existing test case which covers this, but we don't have an issue for it: https://github.com/dotnet/linker/blob/5fca8b890c194c837d21513e43a361a5f5b357a6/test/Mono.Linker.Tests.Cases/DataFlow/LocalDataFlow.cs#L224-L232

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-Tools-ILLink.NET linker development as well as trimming analyzers

    Type

    No type

    Projects

    Status

    No status

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions