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

[kernel] Infinite loop when testing if two record types are equivalent #52817

Closed
nshahan opened this issue Jun 29, 2023 · 0 comments
Closed

[kernel] Infinite loop when testing if two record types are equivalent #52817

nshahan opened this issue Jun 29, 2023 · 0 comments
Assignees
Labels
area-front-end Use area-front-end for front end / CFE / kernel format related issues. front-end-kernel

Comments

@nshahan
Copy link
Contributor

nshahan commented Jun 29, 2023

DDC relies on the kernel implementation of DartTypeEquivalence to determine if some casts can be elided or replaced as null checks.

Some instances of record types can cause an infinite loop when checking if they are equivalent.

Originally reported here: flutter/flutter#129482

This code will cause the DDC compiler to hang:

main() {
  Object value = 'x';
  (a: 'a', b: value) as ({String a, String b});
}
@nshahan nshahan added area-front-end Use area-front-end for front end / CFE / kernel format related issues. front-end-kernel labels Jun 29, 2023
@nshahan nshahan self-assigned this Jun 29, 2023
copybara-service bot pushed a commit that referenced this issue Jul 11, 2023
- Increment index to avoid infinite loop when the first named elements
  in the two record types are equivalent.
- Add some test cases for record types.

Fixes: #52817
Cherry-pick: https://dart-review.googlesource.com/c/sdk/+/311929
Change-Id: Iaa4dbf7d2659deeac1eab642cc3aefad9a08f67e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312709
Commit-Queue: Nicholas Shahan <[email protected]>
Reviewed-by: Sigmund Cherem <[email protected]>
Reviewed-by: Kevin Chisholm <[email protected]>
copybara-service bot pushed a commit that referenced this issue Jul 11, 2023
- Increment index to avoid infinite loop when the first named elements
  in the two record types are equivalent.
- Add some test cases for record types.

Fixes: #52817
Cherry-pick: https://dart-review.googlesource.com/c/sdk/+/311929
Change-Id: I1911346ac2551f1b0eb8587e49675a2ac8f3232b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312710
Reviewed-by: Sigmund Cherem <[email protected]>
Commit-Queue: Nicholas Shahan <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-front-end Use area-front-end for front end / CFE / kernel format related issues. front-end-kernel
Projects
None yet
Development

No branches or pull requests

1 participant