Skip to content

language/nnbd/late/covariant_instance_field_test fails with inlining disabled #56051

@eseidel

Description

@eseidel

I suspect the answer may be "we don't support turning off inlining", but we were experimenting with such this week as part of attempting to fix other issues with Shorebird's linker. Turning off inlining causes only a few tests to fail.

This one is about language/nnbd/late/covariant_instance_field_test. I'll file others if needed/useful.

import 'package:expect/expect.dart';

class Foo {
  covariant late num a;
}

class Bar extends Foo {
  @override
  late int a;
}

void main() {
  Foo bar = Bar();
  bar.a = 2;
  Expect.equals(2, bar.a);
  Expect.throws(() {
    bar.a = 3.14 as dynamic;
    print('bar.a is now ${bar.a}');
  });
  print("success!");
}

Running in stock jit works fine:

dart test.dart
success!

But running in aot with inlining disabled fails:

DART_CONFIGURATION=DebugARM64 pkg/vm/tool/precompiler2 --deterministic --dedup_instructions --compiler-passes=-Inlining test.dart test.aot
xcodebuild/DebugARM64/dart_precompiled_runtime test.aot
bar.a is now -4609118966639786721
Unhandled exception:
Expect.throws fails: Did not throw
#0      Expect._fail (package:expect/expect.dart:881)
#1      Expect.throws (package:expect/expect.dart:766)
#2      main (file:///Users/eseidel/Documents/GitHub/unmodified-dart-sdk/sdk/test.dart:16)
#3      _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:297)
#4      _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:184)

My guess is that some part of the compiler's logic for control flow is now dependent on inlining optimizations for correctness.

Metadata

Metadata

Assignees

Labels

P2A bug or feature request we're likely to work onarea-vmUse area-vm for VM related issues, including code coverage, and the AOT and JIT backends.triage-automationSee https://github.com/dart-lang/ecosystem/tree/main/pkgs/sdk_triage_bot.triagedIssue has been triaged by sub teamtype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions