-
Notifications
You must be signed in to change notification settings - Fork 1.7k
VM crash with type mis-match #43464
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
Comments
/cc @mkustermann |
This happens due to an optimized write-barrier when saving the original argument into the newly allocated context. It thinks the value it stores into the context cannot be a Smi (write barrier is based on The creation and population of context happens before a possible (Due to overriding @sstrickl @askeksa-google Could one of you take a look at this? |
https://dart-review.googlesource.com/c/sdk/+/149063 is the first crashing commit. |
@askeksa-google I don't think so, that CL just improved the precision. Try something like (note class A {}
abstract class B<T> {
dynamic foo(T a);
}
class C extends B<A> {
dynamic foo(A a) {
return () => a;
}
}
main() {
print((C().foo as dynamic)(1));
} The actual issue is somewhere else. |
The bug is that |
I am not convinced that the change https://dart-review.googlesource.com/c/sdk/+/164500 made to fix this bugs needs to be cherry picked into 2.10 stable release (actually the release has already been done and so it would only go into 2.10.1 which means flutter stable will not pick it up unless another dot release of flutter is done). |
@a-siva The actual bug can affect flutter developers during development mode. I think the best course of action for bug fixes that are small and well understood is to file a cherry-pick request and let the committee decide whether they want to actually pick it. Maybe the answer is no, but we should still file the CP. |
I think we should target this for the 2.10 hot fix (similar to #43601) |
@askeksa-google looks like the CL for fixing this issue has not landed yet (https://dart-review.googlesource.com/c/sdk/+/164500) in order to be considered for a hot fix into the stable channel (2.10). |
This avoids unsound optimizations that could arise from loading a parameter before its type had been checked. Affects only unoptimized code. Fixes #43464 Some considerations for a cleaner fix are described in #43654 Change-Id: I05872e46495313e82e9c516e5f283e1bc4612300 Cq-Do-Not-Cancel-Tryjobs: true Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/164500 Commit-Queue: Aske Simon Christensen <[email protected]> Reviewed-by: Martin Kustermann <[email protected]>
I have the following script:
Notice how
I
andO
is the input and output type of each step and how it doesn't match:So when step 2 returns and int and tries to give it to step 3 wanting a string things will go wrong somehow.
This is what happens:
It's not supposed to go wrong like that.
Also notice that simple changes can make the crash go away:
final Iterator<Step> iterator = <Step>[new Step1(), new Step2(), new Step1()].iterator;
givesUnhandled exception: type 'int' is not a subtype of type 'String' of 'start'
(though if one in step1 instead returns"Hello $start"
we get the crash again)."Hello"
instead ofresult
(or seemingly any plain string)) givesUnhandled exception: type 'int' is not a subtype of type 'String' of 'result'
Unhandled exception: type 'int' is not a subtype of type 'String' of 'result'
/cc @mraleph
The text was updated successfully, but these errors were encountered: