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

CFE/dart2js: dart2js/late_fields_with_annotation crashes on fuzzing #49415

Open
jensjoha opened this issue Jul 7, 2022 · 0 comments
Open

CFE/dart2js: dart2js/late_fields_with_annotation crashes on fuzzing #49415

jensjoha opened this issue Jul 7, 2022 · 0 comments
Labels
area-front-end Use area-front-end for front end / CFE / kernel format related issues. web-dart2js

Comments

@jensjoha
Copy link
Contributor

jensjoha commented Jul 7, 2022

This will fail (possibly the status entry in pkg/front_end/testcases/strong.status has to be removed):

out/ReleaseX64/dart --enable-asserts pkg/front_end/test/fasta/strong_suite.dart -DsemiFuzz=true -- strong/dart2js/late_fields_with_annotation

A "normal compile" doesn't fail, but on fuzzing it does like this:

Compiled and got 1 libs
 -> invalidating [...]/pkg/front_end/testcases/dart2js/late_fields_with_annotation.dart
 -> and got 1 libs
Can't serialize, got 'root::[...]/pkg/front_end/testcases/dart2js/late_fields_with_annotation.dart::C::@fields::[...]/pkg/front_end/testcases/dart2js/late_fields_with_annotation.dart::_#C#a#A is already bound to Reference to [...]/pkg/front_end/testcases/dart2js/late_fields_with_annotation.dart::C::@fields::[...]/pkg/front_end/testcases/dart2js/late_fields_with_annotation.dart::_#C#a#A with node C._#C#a#A (Field:323541), trying to bind to Reference to C._#C#a#A with node C._#C#a#A (Field:323829)' from #0      CanonicalName.bindTo (package:kernel/canonical_name.dart:237:7)
#1      Field.bindCanonicalNames (package:kernel/ast.dart:2208:36)
#2      Class.ensureCanonicalNames (package:kernel/ast.dart:1267:17)
#3      Library.ensureCanonicalNames (package:kernel/ast.dart:514:18)
#4      Component.computeCanonicalNamesForLibrary (package:kernel/ast.dart:14028:13)
#5      BinaryPrinter._computeCanonicalNames (package:kernel/binary/ast_to_binary.dart:557:19)
#6      BinaryPrinter.writeComponentFile.<anonymous closure> (package:kernel/binary/ast_to_binary.dart:576:7)
#7      Timeline.timeSync (dart:developer/timeline.dart:160:22)
#8      BinaryPrinter.writeComponentFile (package:kernel/binary/ast_to_binary.dart:574:14)
#9      FuzzCompiles.canSerialize ([...]/pkg/front_end/test/fasta/testing/suite.dart:1427:35)
#10     FuzzCompiles.performFileInvalidation ([...]/pkg/front_end/test/fasta/testing/suite.dart:1340:12)
<asynchronous suspension>
#11     FuzzCompiles.run ([...]/pkg/front_end/test/fasta/testing/suite.dart:1202:45)
<asynchronous suspension>
#12     ChainContext.run.doStep.<anonymous closure> (package:testing/src/chain.dart:196:22)
<asynchronous suspension>

I'm guessing this is what happens: in pkg/compiler/lib/src/kernel/transformations/late_lowering.dart _computeBackingInstanceField a field is "split", among other things changing the name of the field. This means that upon (advanced/experimental) recompile we cannot lookup the field by the original name, we thus create a new reference for it (this is bad as old libraries pointing at it will now point wrong) and when we split it again we again use the new reference and the (same) new name, meaning the canonical name created when serializing will be the same as last time, but that was already bound to the old reference.

I have no immediate good ideas of how to fix this.

/cc @johnniwinther

@jensjoha jensjoha added web-dart2js area-front-end Use area-front-end for front end / CFE / kernel format related issues. labels Jul 7, 2022
copybara-service bot pushed a commit that referenced this issue Jul 8, 2022
Bugs:
#49414
#49415
Change-Id: I7d0af8f1490cd668f21fd1a7f2a1be40418cf4ba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250844
Reviewed-by: Johnni Winther <[email protected]>
Commit-Queue: Jens Johansen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-front-end Use area-front-end for front end / CFE / kernel format related issues. web-dart2js
Projects
None yet
Development

No branches or pull requests

1 participant