1 /* 2 * Copyright (C) 2022 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 17 public class Main { main(String args[])18 public static void main(String args[]) { 19 Test227365246 test227365246 = new Test227365246(); 20 test227365246.$noinline$mainTest(args); 21 22 Test216608614 test216608614 = new Test216608614(); 23 test216608614.$noinline$mainTest(args); 24 25 Test216629762 test216629762 = new Test216629762(); 26 test216629762.$noinline$mainTest(args); 27 } 28 } 29 30 class Test227365246 { 31 int N = 400; 32 int iFld; 33 $noinline$mainTest(String[] strArr1)34 void $noinline$mainTest(String[] strArr1) { 35 int i17, i18 = 5788, i19, i21, i22 = 127, i23; 36 byte[] byArr = new byte[N]; 37 for (i17 = 14; 297 > i17; ++i17) 38 for (int ax$2 = 151430; ax$2 < 235417; ax$2 += 2) {} 39 try { 40 for (i19 = 4; 179 > i19; ++i19) { 41 i18 *= i18; 42 for (i21 = 1; i21 < 58; i21++) 43 for (i23 = i21; 1 + 400 > i23; i23++) { 44 byArr[i23] -= i22; 45 i18 += i23; 46 switch (i19 % 5) { 47 case 107: 48 i19 >>= iFld; 49 } 50 } 51 } 52 } catch (ArrayIndexOutOfBoundsException exc1) { 53 } 54 System.out.println("i17 i18 b = " + i17 + "," + i18 + "," + 0); 55 } 56 } 57 58 class Test216608614 { 59 int N = 400; 60 long lFld; 61 double dFld; 62 int iArrFld[]=new int[N]; $noinline$mainTest(String[] strArr1)63 void $noinline$mainTest(String[] strArr1) { 64 // Note: The original bug report started with `l=-1213929899L` but this took 65 // too long when running with interpreter without JIT and we want to allow 66 // this test to run for all configurations. Starting with `l=-1000000L` was 67 // enough to allow JIT to compile the method for OSR and trigger the bug on host. 68 long l=-1000000L; 69 int i19= 46, i20=100, i21, i22=13, i25; 70 try { 71 do 72 for (; i19 < 172; ++i19) 73 lFld = (long) dFld; 74 while (++l < 146); 75 for (i21 = 8;; ++i21) 76 for (i25 = 1; i25 < 2; i25++) { 77 i20 = i22 % 1650388388; 78 i20 = iArrFld[i21]; 79 i22 = 60; 80 } 81 } catch (ArrayIndexOutOfBoundsException exc1) { 82 } finally { 83 } 84 System.out.println("l i19 i20 = " + l + "," + i19 + "," + i20); 85 } 86 } 87 88 class Test216629762 { 89 static int N = 400; 90 int iFld=29275; 91 volatile double dFld; 92 static long lArrFld[][]=new long[N][N]; 93 $noinline$mainTest(String[] strArr1)94 void $noinline$mainTest(String[] strArr1) { 95 int i8, i10=181, i11, i12=-57574, i13=69, i15= 6, i16= 186, i17= 227; 96 try { 97 for (i11 = 6; i11 < 278 + 400; ++i11) 98 i12 *= iFld; 99 for (;; i13++) { 100 i10 /= i10; 101 i16 += i15; 102 lArrFld[i13][i15] >>= 31616; 103 for (i17 = 1; i17 < 1 + 400; i17++) 104 dFld += dFld; 105 } 106 } 107 catch (ArrayIndexOutOfBoundsException exc2) { 108 i16 += i12; 109 } 110 System.out.println("i16 b i17 = " + i16 + "," + 0 + "," + i17); 111 } 112 } 113