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

Don't hoist ref locals #43463

Merged
merged 7 commits into from
Apr 21, 2020
Merged

Don't hoist ref locals #43463

merged 7 commits into from
Apr 21, 2020

Conversation

RikkiGibson
Copy link
Contributor

Closes #40251

@gafter could you please take a look? Without this change, we crash in debug mode, while giving the "expected" behavior (either giving an emit diagnostic or compiling successfully) in release mode.

@RikkiGibson RikkiGibson requested a review from a team as a code owner April 17, 2020 23:00
@jcouv
Copy link
Member

jcouv commented Apr 17, 2020

Glad it worked :-)
Can you take a look at linked issues? I think there was more than one related to ref locals in async methods.

@RikkiGibson
Copy link
Contributor Author

RikkiGibson commented Apr 17, 2020

I poked around at some linked issues and didn't see others that seemed affected. I think this only resolves issues where either:

  1. the compiler was crashing in lowering,
  2. or there were errors given that should not have been given.

";

var comp = CreateCompilation(source, options: TestOptions.DebugDll);
comp.VerifyEmitDiagnostics();
Copy link
Contributor

@AlekseyTs AlekseyTs Apr 18, 2020

Choose a reason for hiding this comment

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

comp.VerifyEmitDiagnostics(); [](start = 12, length = 29)

Consider running the scenario and observing expected behavior at runtime. #Closed

var comp = CreateCompilation(source, options: TestOptions.DebugDll);
comp.VerifyEmitDiagnostics();
comp = CreateCompilation(source, options: TestOptions.ReleaseDll);
comp.VerifyEmitDiagnostics();
Copy link
Contributor

@AlekseyTs AlekseyTs Apr 18, 2020

Choose a reason for hiding this comment

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

comp.VerifyEmitDiagnostics(); [](start = 12, length = 29)

Here as well. #Closed

Copy link
Contributor

@AlekseyTs AlekseyTs left a comment

Choose a reason for hiding this comment

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

LGTM (iteration 2), modulo suggestion to strengthen tests.

@jcouv
Copy link
Member

jcouv commented Apr 20, 2020

@RikkiGibson Here are some issues I had in mind:

They also involve ref locals in async methods, but those aren't crashes, so unlikely the same issue :-(

Copy link
Member

@jcouv jcouv left a comment

Choose a reason for hiding this comment

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

LGTM Thanks (iteration 4)

@jcouv jcouv self-assigned this Apr 20, 2020
{
public async Task Step(Task<int> t)
{
ReadMemory() = await t;
Copy link
Member

Choose a reason for hiding this comment

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

Consider adding a test where we have a ref l-value and use a compound operator. Essentially

ReadMemory() += await t;

Copy link
Contributor

@AlekseyTs AlekseyTs left a comment

Choose a reason for hiding this comment

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

LGTM (iteration 5)

@RikkiGibson RikkiGibson merged commit c0d2137 into dotnet:master Apr 21, 2020
@ghost ghost added this to the Next milestone Apr 21, 2020
@RikkiGibson RikkiGibson deleted the fix-40251 branch April 21, 2020 20:50
@sharwell sharwell modified the milestones: Next, temp, 16.7.P1 Apr 28, 2020
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.

error MSB6006: "csc.exe" exited with code -2146232797.
5 participants