Open simolus3 opened 3 years ago
Much smaller repro, note that the frontend generates similar files for invalid sources.
// @dart=2.9
import 'dart:io';
import 'dart:isolate';
import 'package:kernel/kernel.dart';
void main() {
final component = Component();
final lib = Library(Uri.parse('package:foo/bar.dart'));
component.libraries.add(lib);
final field = Field.immutable(Name('field'),
initializer: InvalidExpression('field'), isStatic: true);
lib.addField(field);
final fun = FunctionNode(ExpressionStatement(StaticGet(field)));
final proc =
Procedure(Name('main'), ProcedureKind.Method, fun, isStatic: true);
lib.addProcedure(proc);
component.setMainMethodAndMode(
proc.reference, true, NonNullableByDefaultCompiledMode.Weak);
final file = File('crash.dill')
..writeAsBytesSync(writeComponentToBytes(component));
Isolate.spawnUri(
Uri.file(file.absolute.path),
const [],
ReceivePort().sendPort,
onError: ReceivePort().sendPort,
);
}
In Isolate::NotifyErrorListeners
, stacktrace
is a nullptr which I think is causing the errors here.
When running a kernel file referencing a field with an
InvalidExpression
as its initializer in an isolate with anonError
handler, the VM crashes:See the comment for an easy repro. I've tested this on 2.12.4 stable and 2.14.0-57.0.dev.