b9f2c264ef
The code previously used the target offset directly instead of the JumpLabel which could cause it to miss multiple indirections, causing a -1 offset. This would manifest as a jump to an entry which would be off-by-minus-one and thus hit the pre-code int3 barrier. Bug: https://github.com/flutter/flutter/issues/51298 Change-Id: I0ef7d8ed578594bfb5fe9544f9b4aebaabc86275 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137303 Reviewed-by: Vyacheslav Egorov <vegorov@google.com> Commit-Queue: Clement Skau <cskau@google.com>
36 lines
865 B
Dart
36 lines
865 B
Dart
// Copyright (c) 2020, 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=--async_igoto_threshold=0 --optimization_counter_threshold=10 --deterministic
|
|
|
|
// Regression test for https://github.com/flutter/flutter/issues/51298.
|
|
// This would cause a crash due to bad offsets causing entry to hit the pre-code
|
|
// barrier of int3s.
|
|
|
|
import 'dart:async';
|
|
|
|
Iterable<bool> state_machine() sync* {
|
|
bool a = true;
|
|
|
|
for (var i = 0; i < 2; i++) {
|
|
switch (a) {
|
|
case true:
|
|
a = false;
|
|
break;
|
|
}
|
|
}
|
|
|
|
switch (a) {
|
|
case false:
|
|
if (!a) {
|
|
yield a;
|
|
}
|
|
}
|
|
}
|
|
|
|
void main() {
|
|
// This would crash due to bad flowgraph entry offsets.
|
|
for (final _ in state_machine()) {}
|
|
}
|