Skip to content

Bug in VM async implementation #22782

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
sigurdm opened this issue Mar 11, 2015 · 5 comments
Closed

Bug in VM async implementation #22782

sigurdm opened this issue Mar 11, 2015 · 5 comments
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.

Comments

@sigurdm
Copy link
Contributor

sigurdm commented Mar 11, 2015

The program:

var p;

test(ex, o) {
  if (ex != o) throw "Error '$ex' != '$o'";
}

main() async {
  await 3;
  p = (i) async => "${await i}";
  test(await "1", (await (p(1))));
}

prints:

Unhandled exception:
Uncaught Error: Error '1' != '1'
Stack Trace:
...

@sigurdm
Copy link
Contributor Author

sigurdm commented Mar 12, 2015

Here is a simpler version, that might show more about what is going wrong:

test(ex, o) {
  if (ex != "1") throw "Error $ex '${ex.runtimeType}'";
}

main() async {
  await null;
  p(i) async => "${await i}";
  test(await "1", (await (p(2))));
}

Prints:
Uncaught Error: Error 2 'int'

@DartBot
Copy link

DartBot commented Mar 16, 2015

This comment was originally written by @mhausner


This could very well be the same root cause as issue #22858, because the bug goes away if I reorder some statements. I slightly simplified the example to this:

test(ex, o) {
  if (ex != "1") throw "Error $ex '${ex.runtimeType}'";
}

main() async {
  await null;
  p() async => await "2";
  test(await "1", await p());
}

@iposva-google
Copy link
Contributor

cc @crelier.
Set owner to @sgmitrovic.
Added Accepted label.

@DartBot
Copy link

DartBot commented Mar 16, 2015

This comment was originally written by @mhausner


The bug was that the local function p() accidentally re-used a temporary variable from main. The effect was that the call to p() overwrote the value "1" saved from 'await "1"'

https://codereview.chromium.org/1007393004/


Added Started label.

@DartBot
Copy link

DartBot commented Mar 16, 2015

This comment was originally written by @mhausner


Fixed in r44526


Added Fixed label.

@sigurdm sigurdm added Type-Defect area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. labels Mar 16, 2015
@sigurdm sigurdm assigned ghost Mar 16, 2015
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.
Projects
None yet
Development

No branches or pull requests

4 participants