-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Finally block belonging to unexecuted try runs anyway #10955
Comments
This looks like it might be a bug in the C# compiler's optimizer. The IL for
|
I see, I should've checked. Should I move this over to https://github.com/dotnet/roslyn? |
Looks like Roslyn bug. |
I don't think this is related to dead code elimination. This was the original example: // Debug: Outputs True
// Release: Outputs False
public class Program
{
static bool s_1 = true;
static bool[] s_2 = new bool[]{false};
static long s_6;
public static void Main()
{
M0();
System.Console.WriteLine(s_1);
}
static void M0()
{
try
{
if (s_2[0])
{
try
{
return;
}
finally
{
s_1 = s_2[0];
}
}
else
{
return;
}
}
finally
{
s_6 = s_6;
}
}
} |
This issue was moved to dotnet/roslyn#29481 |
The following program prints something in release even though it shouldn't:
Disassembly is:
The text was updated successfully, but these errors were encountered: