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

BinaryPrinter._getVariableIndex crash #49122

Closed
Hixie opened this issue May 26, 2022 · 0 comments
Closed

BinaryPrinter._getVariableIndex crash #49122

Hixie opened this issue May 26, 2022 · 0 comments
Assignees
Labels
area-front-end Use area-front-end for front end / CFE / kernel format related issues. front-end-kernel type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@Hixie
Copy link
Contributor

Hixie commented May 26, 2022

This rather dubious code:

test(x) => x();

void main() {
  test(bar() { print(bar); });
}

...causes this crash when run using dart test.dart:

ianh@burmese:~/dev/scratch$ dart test.dart
Null check operator used on a null value
#0      BinaryPrinter._getVariableIndex (package:kernel/binary/ast_to_binary.dart:83:17)
#1      BinaryPrinter.visitVariableGet (package:kernel/binary/ast_to_binary.dart:1497:17)
#2      VariableGet.accept (package:kernel/ast.dart:4144:44)
#3      BinaryPrinter.writeNode (package:kernel/binary/ast_to_binary.dart:430:10)
#4      BinaryPrinter.writeNodeList (package:kernel/binary/ast_to_binary.dart:340:7)
#5      BinaryPrinter.visitArguments (package:kernel/binary/ast_to_binary.dart:1777:5)
#6      Arguments.accept (package:kernel/ast.dart:5316:38)
#7      BinaryPrinter.writeArgumentsNode (package:kernel/binary/ast_to_binary.dart:444:10)
#8      BinaryPrinter.visitStaticInvocation (package:kernel/binary/ast_to_binary.dart:1760:5)
#9      StaticInvocation.accept (package:kernel/ast.dart:6601:44)
#10     BinaryPrinter.writeNode (package:kernel/binary/ast_to_binary.dart:430:10)
#11     BinaryPrinter.visitExpressionStatement (package:kernel/binary/ast_to_binary.dart:2079:5)
#12     ExpressionStatement.accept (package:kernel/ast.dart:9141:43)
#13     BinaryPrinter.writeNode (package:kernel/binary/ast_to_binary.dart:430:10)
#14     BinaryPrinter.writeNodeList (package:kernel/binary/ast_to_binary.dart:340:7)
#15     BinaryPrinter.visitBlock (package:kernel/binary/ast_to_binary.dart:2090:5)
#16     Block.accept (package:kernel/ast.dart:9197:43)
#17     BinaryPrinter.writeNode (package:kernel/binary/ast_to_binary.dart:430:10)
#18     BinaryPrinter.writeOptionalNode (package:kernel/binary/ast_to_binary.dart:522:7)
#19     BinaryPrinter.visitFunctionNode (package:kernel/binary/ast_to_binary.dart:1481:5)
#20     FunctionNode.accept (package:kernel/ast.dart:3846:38)
#21     BinaryPrinter.writeFunctionNode (package:kernel/binary/ast_to_binary.dart:437:10)
#22     BinaryPrinter.visitFunctionExpression (package:kernel/binary/ast_to_binary.dart:2023:5)
#23     FunctionExpression.accept (package:kernel/ast.dart:8592:44)
#24     BinaryPrinter.writeNode (package:kernel/binary/ast_to_binary.dart:430:10)
#25     BinaryPrinter.writeOptionalNode (package:kernel/binary/ast_to_binary.dart:522:7)
#26     BinaryPrinter.writeVariableDeclaration (package:kernel/binary/ast_to_binary.dart:2293:5)
#27     BinaryPrinter.visitLet (package:kernel/binary/ast_to_binary.dart:2033:5)
#28     Let.accept (package:kernel/ast.dart:8703:44)
#29     BinaryPrinter.writeNode (package:kernel/binary/ast_to_binary.dart:430:10)
#30     BinaryPrinter.writeNodeList (package:kernel/binary/ast_to_binary.dart:340:7)
#31     BinaryPrinter.visitArguments (package:kernel/binary/ast_to_binary.dart:1777:5)
#32     Arguments.accept (package:kernel/ast.dart:5316:38)
#33     BinaryPrinter.writeArgumentsNode (package:kernel/binary/ast_to_binary.dart:444:10)
#34     BinaryPrinter.visitStaticInvocation (package:kernel/binary/ast_to_binary.dart:1760:5)
#35     StaticInvocation.accept (package:kernel/ast.dart:6601:44)
#36     BinaryPrinter.writeNode (package:kernel/binary/ast_to_binary.dart:430:10)
#37     BinaryPrinter.visitExpressionStatement (package:kernel/binary/ast_to_binary.dart:2079:5)
#38     ExpressionStatement.accept (package:kernel/ast.dart:9141:43)
#39     BinaryPrinter.writeNode (package:kernel/binary/ast_to_binary.dart:430:10)
#40     BinaryPrinter.writeNodeList (package:kernel/binary/ast_to_binary.dart:340:7)
#41     BinaryPrinter.visitBlock (package:kernel/binary/ast_to_binary.dart:2090:5)
#42     Block.accept (package:kernel/ast.dart:9197:43)
#43     BinaryPrinter.writeNode (package:kernel/binary/ast_to_binary.dart:430:10)
#44     BinaryPrinter.writeOptionalNode (package:kernel/binary/ast_to_binary.dart:522:7)
#45     BinaryPrinter.visitFunctionNode (package:kernel/binary/ast_to_binary.dart:1481:5)
#46     FunctionNode.accept (package:kernel/ast.dart:3846:38)
#47     BinaryPrinter.writeFunctionNode (package:kernel/binary/ast_to_binary.dart:437:10)
#48     BinaryPrinter.visitProcedure (package:kernel/binary/ast_to_binary.dart:1312:5)
#49     Procedure.accept (package:kernel/ast.dart:3151:40)
#50     BinaryPrinter.writeProcedureNode (package:kernel/binary/ast_to_binary.dart:458:10)
#51     BinaryPrinter.writeProcedureNodeList (package:kernel/binary/ast_to_binary.dart:349:7)
#52     BinaryPrinter.visitLibrary (package:kernel/binary/ast_to_binary.dart:1063:5)
#53     Library.accept (package:kernel/ast.dart:565:38)
#54     BinaryPrinter.writeLibraryNode (package:kernel/binary/ast_to_binary.dart:451:10)
#55     BinaryPrinter.writeLibraries (package:kernel/binary/ast_to_binary.dart:756:9)
#56     BinaryPrinter.writeComponentFile.<anonymous closure> (package:kernel/binary/ast_to_binary.dart:595:7)
#57     Timeline.timeSync (dart:developer/timeline.dart:160:22)
#58     BinaryPrinter.writeComponentFile (package:kernel/binary/ast_to_binary.dart:577:14)
#59     serializeComponent (package:front_end/src/fasta/kernel/utils.dart:94:11)
#60     _processLoadRequest (file:///b/s/w/ir/cache/builder/sdk/pkg/vm/bin/kernel_service.dart:910:13)
<asynchronous suspension>
@lrhn lrhn added type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) area-front-end Use area-front-end for front end / CFE / kernel format related issues. front-end-kernel labels May 27, 2022
@johnniwinther johnniwinther self-assigned this May 30, 2022
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. front-end-kernel type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

3 participants