blob: a0ae4c3556e8609d0953cd996d1ae4daa48c46ef [file] [log] [blame]
Nicolas Geoffray8d82a0c2015-06-20 23:49:01 +01001/*
2 * Copyright (C) 2015 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17public class Main {
18 public static int[] bar(int[] a) {
19 a[0] = 0;
20 a[1] = 0;
21 a[2] = 0;
22 // Up to this point, we record that the lower bound is 2.
23 // The next instruction will record that the lower bound is 5.
24 // The deoptimization code used to assume the lower bound has
25 // to be check it will add for the deoptimization (here, it
26 // would be 2).
27 return new int[a.length - 5];
28 }
29
30 public static void main(String[] args) {
31 int[] a = new int[5];
32 a = bar(a);
33 if (a.length != 0) {
34 throw new Error("Expected 0, got " + a.length);
35 }
36 }
37}