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

[CP] Fix for issue #59901 #59924

Open
osa1 opened this issue Jan 17, 2025 · 3 comments
Open

[CP] Fix for issue #59901 #59924

osa1 opened this issue Jan 17, 2025 · 3 comments
Assignees
Labels
area-dart2wasm Issues for the dart2wasm compiler. cherry-pick-review Issue that need cherry pick triage to approve triage-automation See https://github.com/dart-lang/ecosystem/tree/main/pkgs/sdk_triage_bot. type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@osa1
Copy link
Member

osa1 commented Jan 17, 2025

Commit(s) to merge

Target

beta

Prepared changelist for beta/stable

(Is this necessary? https://github.com/dart-lang/sdk/blob/main/docs/Cherry-picks-to-a-release-channel.md says changelog is only necessary for CPs into stable)

Issue Description

In code like if (x == <string constant>) { ... use x ... } TFA normally propagates the information that x equals to the string constant when processing the body of the conditional.

However unlike in VM, in dart2wasm, x being equal to a string constant or literal does not mean x and the literal or constant have the same class.

Assuming this causes miscompilation, which manifests itself as a runtime crash.

What is the fix

Don't assume that, in dart2wasm, a variable being equal to a string means the variable and string have the same class.

Why cherry-pick

Blocks user migrating from dart:html to package:web.

Risk

None

Issue link(s)

#59901

@osa1 osa1 added the cherry-pick-review Issue that need cherry pick triage to approve label Jan 17, 2025
@dart-github-bot
Copy link
Collaborator

Summary: Dart2wasm incorrectly assumed string variable and literal equality implied same class, causing miscompilation and crashes. The fix prevents this assumption in dart2wasm.

@dart-github-bot dart-github-bot added area-dart2wasm Issues for the dart2wasm compiler. triage-automation See https://github.com/dart-lang/ecosystem/tree/main/pkgs/sdk_triage_bot. type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) labels Jan 17, 2025
@mit-mit
Copy link
Member

mit-mit commented Jan 17, 2025

SGTM

@gmpassos
Copy link
Contributor

gmpassos commented Jan 17, 2025

Thanks for cherry-picking this. I was about to open a CP issue, but then I saw this.

Please, release a Dart 3.6.2 if possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-dart2wasm Issues for the dart2wasm compiler. cherry-pick-review Issue that need cherry pick triage to approve triage-automation See https://github.com/dart-lang/ecosystem/tree/main/pkgs/sdk_triage_bot. type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

7 participants