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

Left shift by negative amount causes analyzer crash #33481

Closed
mkustermann opened this issue Jun 18, 2018 · 2 comments
Closed

Left shift by negative amount causes analyzer crash #33481

mkustermann opened this issue Jun 18, 2018 · 2 comments
Assignees
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Milestone

Comments

@mkustermann
Copy link
Member

% cat test.dart
 class X { final x; const X(this.x); }

 void main() {
   print(const X(1 << -1).x);
 }

% dartanalyzer  test.dart     
Analyzing test.dart...                                                                       
Unhandled exception:                                                                               
Invalid argument(s): -1                                                                                
#0      int._shlFromInt (dart:core/runtime/libintegers.dart:465:53)                   
#1      int.<< (dart:core/runtime/libintegers.dart:60:39)                                     
#2      IntState.shiftLeft (package:analyzer/src/dart/constant/value.dart:2288:33)                  
#3      DartObjectImpl.shiftLeft (package:analyzer/src/dart/constant/value.dart:638:40)
#4      DartObjectComputer.shiftLeft (package:analyzer/src/dart/constant/evaluation.dart:1991:28)
#5      ConstantVisitor.visitBinaryExpression (package:analyzer/src/dart/constant/evaluation.dart:1291:34)
#6      BinaryExpressionImpl.accept (package:analyzer/src/dart/ast/ast.dart:1215:49)            
#7      ConstantVisitor._valueOf (package:analyzer/src/dart/constant/evaluation.dart:1672:49)
#8      ConstantEvaluationEngine.evaluateConstructorCall (package:analyzer/src/dart/constant/evaluation.dart:446:45)
#9      ConstantVerifier.visitInstanceCreationExpression (package:analyzer/src/generated/resolver.dart:1667:26)                           
#10     InstanceCreationExpressionImpl.accept (package:analyzer/src/dart/ast/ast.dart:6577:15)                                       
#11     PropertyAccessImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:9167:14)                             
#12     RecursiveAstVisitor.visitPropertyAccess (package:analyzer/dart/ast/visitor.dart:1079:10)                         
...
% dartanalyzer --version
dartanalyzer version 2.0.0-dev.63.0
@mkustermann mkustermann added the area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. label Jun 18, 2018
@mkustermann
Copy link
Member Author

Actually there are 3 issues with integers:

  • left shift by negative shifter: Crash
  • right shift by negative shifter: Crash
  • modulos of 0: MissingCompileTimeError

I'll add at test for this and mark it in the status files.

dart-bot pushed a commit that referenced this issue Jun 19, 2018
…aluator

Issue #33481

Closes #33469

Change-Id: I7ca9825a0aa5f062732a759b4dd116e716a0d1b3
Reviewed-on: https://dart-review.googlesource.com/60580
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
@bwilkerson bwilkerson added the type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) label Aug 28, 2018
@bwilkerson bwilkerson added this to the Dart2.1 milestone Aug 28, 2018
@scheglov scheglov self-assigned this Sep 5, 2018
@scheglov
Copy link
Contributor

scheglov commented Sep 5, 2018

@scheglov scheglov closed this as completed Sep 5, 2018
dart-bot pushed a commit that referenced this issue Sep 5, 2018
R=brianwilkerson@google.com

Bug: #33481
Change-Id: I0cc1b07b222f1fe739df6c720d7357a2453ee1b9
Reviewed-on: https://dart-review.googlesource.com/73040
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

4 participants