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

VM crash when type Never is used #39466

Closed
eernstg opened this issue Nov 20, 2019 · 5 comments
Closed

VM crash when type Never is used #39466

eernstg opened this issue Nov 20, 2019 · 5 comments
Assignees
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. NNBD Issues related to NNBD Release type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) vm-nnbd-unfork-sdk Label for all issues that need to be done before the nnbd sdk can be unforked

Comments

@eernstg
Copy link
Member

eernstg commented Nov 20, 2019

Consider the following two programs:

import 'dart:core' as core;

main() {
  core.Never n = throw "away";
}
main() {
  Never n = throw "away";
}

Both of them cause a crash in dart from commit 11d523d (but dartanalyzer accepts the programs):

> dart --enable-experiment=non-nullable n039.dart; dart --enable-experiment=non-nullable n040.dart
Unhandled exception:
'file:///usr/local/google/home/eernst/lang/dart/scratch/201911/n039.dart': error: Unexpected tag 1 (Something) in ::.main, expected expression
#0      _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:307:19)
#1      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:174:12)
Unhandled exception:
'file:///usr/local/google/home/eernst/lang/dart/scratch/201911/n040.dart': error: Unexpected tag 1 (Something) in ::.main, expected expression
#0      _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:307:19)
#1      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:174:12)

The NNBD specification indicates that Never is declared in 'dart:core', so both should work.

The following form causes the same crash (before execution starts), so it isn't caused by the use of throw "away" as an initializing expression:

import 'dart:core' as core;

main() {
  core.dynamic d = 42;
  core.Never n = d;
}
@eernstg eernstg added area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) NNBD Issues related to NNBD Release labels Nov 20, 2019
@crelier crelier added area-front-end Use area-front-end for front end / CFE / kernel format related issues. and removed area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. labels Nov 20, 2019
@crelier crelier removed their assignment Nov 20, 2019
@crelier
Copy link
Contributor

crelier commented Nov 20, 2019

I am not sure why it works in dartanalyzer, but these errors are produced by the front-end.
I am reassigning the issue.

@sgrekhov
Copy link
Contributor

See also #39461

@crelier crelier self-assigned this Nov 21, 2019
@crelier crelier added area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. and removed area-front-end Use area-front-end for front end / CFE / kernel format related issues. labels Nov 21, 2019
@crelier
Copy link
Contributor

crelier commented Nov 21, 2019

Never mind :-)
Having a second look.

@crelier
Copy link
Contributor

crelier commented Nov 21, 2019

Although the type Never is always non-nullable, the CFE writes a nullability
byte in kernel files that was not properly skipped by the VM.
A CL is under review.

dart-bot pushed a commit that referenced this issue Nov 21, 2019
Although the type Never is always non-nullable, the CFE writes a nullability
byte in kernel files that was not properly skipped by the VM.

This fixes issues
#39466
and
#39461.

Change-Id: I93c44ed99173789fb19ddf9995f440d08e1c944b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125929
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
@crelier
Copy link
Contributor

crelier commented Nov 21, 2019

Fixed by af541cd

@crelier crelier closed this as completed Nov 21, 2019
@a-siva a-siva added the vm-nnbd-unfork-sdk Label for all issues that need to be done before the nnbd sdk can be unforked label Jan 16, 2020
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. NNBD Issues related to NNBD Release type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) vm-nnbd-unfork-sdk Label for all issues that need to be done before the nnbd sdk can be unforked
Projects
None yet
Development

No branches or pull requests

4 participants