dart-sdk/tests/language/vm/regress_45525_test.dart
Ryan Macnak 76e41bc4c5 [vm, compiler] Use correct size of Smi when truncating during constant folding.
TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/45525
Change-Id: I048a90eade678f610f0fd4451b099711a1faa957
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/193750
Reviewed-by: Liam Appelbe <liama@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2021-04-01 16:19:42 +00:00

27 lines
598 B
Dart

// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// VMOptions=--optimization-counter-threshold=10 --no-background-compilation
import "package:expect/expect.dart";
dynamic a() {
return 23;
}
dynamic b() {
return 26;
}
@pragma("vm:never-inline")
dynamic foo() {
// BinarySmiOp(<<) marked truncating
return (a() << b()) & 0xFFFFFFF;
}
main() {
for (var i = 0; i < 20; i++) {
Expect.equals(201326592, foo());
}
}