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

stackalloc expressions have limited syntax #22046

Closed
OmarTawfik opened this issue Sep 11, 2017 · 2 comments
Closed

stackalloc expressions have limited syntax #22046

OmarTawfik opened this issue Sep 11, 2017 · 2 comments

Comments

@OmarTawfik
Copy link
Contributor

Due to a CLR spec limitation, stackalloc instructions cannot be executed unless the evaluation stack is cleared of other items. This means that the following code will not be executed at run-time:

DoSomething(obj1, stackalloc int[10]);

For that to happen, we need to save (spill) all prior values on the evaluation stack to temps before executing this instruction. For now, in feature branch freatures/readonly-ref, the scope of this instruction is constricted to either (1) initialization statements or (2) ternary conditional operators.

@gafter
Copy link
Member

gafter commented Jul 27, 2018

This is tracked as a language issue at dotnet/csharplang#1412

@gafter gafter modified the milestones: Unknown, 16.0 Jul 27, 2018
@gafter gafter self-assigned this Jul 27, 2018
@gafter
Copy link
Member

gafter commented Aug 14, 2018

This is relaxed (by spilling) in #28969

@gafter gafter closed this as completed Aug 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants