Skip to content

[CP] Fix compiler crash when returning a value of uninitialized late variable from async function #50894

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

Closed
alexmarkov opened this issue Jan 4, 2023 · 4 comments
Assignees
Labels
cherry-pick-approved Label for approved cherrypick request cherry-pick-review Issue that need cherry pick triage to approve

Comments

@alexmarkov
Copy link
Contributor

Commit(s) to merge

b205ea1

Target

beta, stable

Prepared changelist for beta/stable

https://dart-review.googlesource.com/c/sdk/+/278362, https://dart-review.googlesource.com/c/sdk/+/278361

Issue Description

AOT compiler crashed on the Dart code which was returning a value of uninitialized late local variable from async function.

What is the fix

Internal classes (such as uninitialized sentinel) are properly handled when checking if return value of async function is a Future.

Why cherry-pick

Reported by user; this bug prevents building their Flutter app in profile/release modes.

Risk

low

Issue link(s)

flutter/flutter#117892

Extra Info

No response

@alexmarkov alexmarkov added the cherry-pick-review Issue that need cherry pick triage to approve label Jan 4, 2023
@alexmarkov
Copy link
Contributor Author

@a-siva @mraleph

@mit-mit
Copy link
Member

mit-mit commented Jan 4, 2023

SGTM

1 similar comment
@mraleph
Copy link
Member

mraleph commented Jan 4, 2023

SGTM

@vsmenon
Copy link
Member

vsmenon commented Jan 4, 2023

lgtm

@itsjustkevin itsjustkevin added the cherry-pick-approved Label for approved cherrypick request label Jan 9, 2023
copybara-service bot pushed a commit that referenced this issue Jan 9, 2023
…zed late variable from async function

This change fixes CompileType::CanBeFuture() which previously attempted
to use Class objects by class id without first checking if cid is internal.

Cid can be internal (SentinelCid) when CompileType::CanBeFuture() is
called for a return value of an async function when it is returning
a value of an uninitialized late local variable (such Return
instruction is unreachable).

TEST=runtime/tests/vm/dart/regress_flutter117892_test.dart
Bug: flutter/flutter#117892
Bug: #50894

Cherry-pick: https://dart-review.googlesource.com/c/sdk/+/278094
Change-Id: I046b8f3ca9f3b71200be61568be5f66320d6dad3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278361
Reviewed-by: Siva Annamalai <[email protected]>
Commit-Queue: Alexander Markov <[email protected]>
copybara-service bot pushed a commit that referenced this issue Jan 9, 2023
…d late variable from async function

This change fixes CompileType::CanBeFuture() which previously attempted
to use Class objects by class id without first checking if cid is internal.

Cid can be internal (SentinelCid) when CompileType::CanBeFuture() is
called for a return value of an async function when it is returning
a value of an uninitialized late local variable (such Return
instruction is unreachable).

TEST=runtime/tests/vm/dart/regress_flutter117892_test.dart
Bug: flutter/flutter#117892
Bug: #50894

Cherry-pick: https://dart-review.googlesource.com/c/sdk/+/278094
Change-Id: I51653bdea62eebe2b73bdf98397112f011a0d112
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278362
Reviewed-by: Slava Egorov <[email protected]>
Commit-Queue: Alexander Markov <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-pick-approved Label for approved cherrypick request cherry-pick-review Issue that need cherry pick triage to approve
Projects
None yet
Development

No branches or pull requests

7 participants