author | phh |
Sat, 30 Nov 2019 14:33:05 -0800 | |
changeset 59330 | 5b96c12f909d |
parent 47216 | 71c04702a3d5 |
permissions | -rw-r--r-- |
42883
5495adce1e0d
8170464: Remove shell script from compiler/c2/cr7005594/Test7005594.java
bmoloden
parents:
diff
changeset
|
1 |
/* |
5495adce1e0d
8170464: Remove shell script from compiler/c2/cr7005594/Test7005594.java
bmoloden
parents:
diff
changeset
|
2 |
* Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved. |
5495adce1e0d
8170464: Remove shell script from compiler/c2/cr7005594/Test7005594.java
bmoloden
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
5495adce1e0d
8170464: Remove shell script from compiler/c2/cr7005594/Test7005594.java
bmoloden
parents:
diff
changeset
|
4 |
* |
5495adce1e0d
8170464: Remove shell script from compiler/c2/cr7005594/Test7005594.java
bmoloden
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
5495adce1e0d
8170464: Remove shell script from compiler/c2/cr7005594/Test7005594.java
bmoloden
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
5495adce1e0d
8170464: Remove shell script from compiler/c2/cr7005594/Test7005594.java
bmoloden
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
5495adce1e0d
8170464: Remove shell script from compiler/c2/cr7005594/Test7005594.java
bmoloden
parents:
diff
changeset
|
8 |
* |
5495adce1e0d
8170464: Remove shell script from compiler/c2/cr7005594/Test7005594.java
bmoloden
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
5495adce1e0d
8170464: Remove shell script from compiler/c2/cr7005594/Test7005594.java
bmoloden
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
5495adce1e0d
8170464: Remove shell script from compiler/c2/cr7005594/Test7005594.java
bmoloden
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
5495adce1e0d
8170464: Remove shell script from compiler/c2/cr7005594/Test7005594.java
bmoloden
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
5495adce1e0d
8170464: Remove shell script from compiler/c2/cr7005594/Test7005594.java
bmoloden
parents:
diff
changeset
|
13 |
* accompanied this code). |
5495adce1e0d
8170464: Remove shell script from compiler/c2/cr7005594/Test7005594.java
bmoloden
parents:
diff
changeset
|
14 |
* |
5495adce1e0d
8170464: Remove shell script from compiler/c2/cr7005594/Test7005594.java
bmoloden
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
5495adce1e0d
8170464: Remove shell script from compiler/c2/cr7005594/Test7005594.java
bmoloden
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
5495adce1e0d
8170464: Remove shell script from compiler/c2/cr7005594/Test7005594.java
bmoloden
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
5495adce1e0d
8170464: Remove shell script from compiler/c2/cr7005594/Test7005594.java
bmoloden
parents:
diff
changeset
|
18 |
* |
5495adce1e0d
8170464: Remove shell script from compiler/c2/cr7005594/Test7005594.java
bmoloden
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
5495adce1e0d
8170464: Remove shell script from compiler/c2/cr7005594/Test7005594.java
bmoloden
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
5495adce1e0d
8170464: Remove shell script from compiler/c2/cr7005594/Test7005594.java
bmoloden
parents:
diff
changeset
|
21 |
* questions. |
5495adce1e0d
8170464: Remove shell script from compiler/c2/cr7005594/Test7005594.java
bmoloden
parents:
diff
changeset
|
22 |
*/ |
5495adce1e0d
8170464: Remove shell script from compiler/c2/cr7005594/Test7005594.java
bmoloden
parents:
diff
changeset
|
23 |
|
5495adce1e0d
8170464: Remove shell script from compiler/c2/cr7005594/Test7005594.java
bmoloden
parents:
diff
changeset
|
24 |
/** |
5495adce1e0d
8170464: Remove shell script from compiler/c2/cr7005594/Test7005594.java
bmoloden
parents:
diff
changeset
|
25 |
* @test |
5495adce1e0d
8170464: Remove shell script from compiler/c2/cr7005594/Test7005594.java
bmoloden
parents:
diff
changeset
|
26 |
* @bug 7005594 |
5495adce1e0d
8170464: Remove shell script from compiler/c2/cr7005594/Test7005594.java
bmoloden
parents:
diff
changeset
|
27 |
* @summary Array overflow not handled correctly with loop optimzations |
5495adce1e0d
8170464: Remove shell script from compiler/c2/cr7005594/Test7005594.java
bmoloden
parents:
diff
changeset
|
28 |
* |
5495adce1e0d
8170464: Remove shell script from compiler/c2/cr7005594/Test7005594.java
bmoloden
parents:
diff
changeset
|
29 |
* @run main/othervm -Xcomp |
5495adce1e0d
8170464: Remove shell script from compiler/c2/cr7005594/Test7005594.java
bmoloden
parents:
diff
changeset
|
30 |
-XX:CompileOnly=compiler.c2.Test7005594::test |
5495adce1e0d
8170464: Remove shell script from compiler/c2/cr7005594/Test7005594.java
bmoloden
parents:
diff
changeset
|
31 |
compiler.c2.Test7005594 |
5495adce1e0d
8170464: Remove shell script from compiler/c2/cr7005594/Test7005594.java
bmoloden
parents:
diff
changeset
|
32 |
*/ |
5495adce1e0d
8170464: Remove shell script from compiler/c2/cr7005594/Test7005594.java
bmoloden
parents:
diff
changeset
|
33 |
|
5495adce1e0d
8170464: Remove shell script from compiler/c2/cr7005594/Test7005594.java
bmoloden
parents:
diff
changeset
|
34 |
package compiler.c2; |
5495adce1e0d
8170464: Remove shell script from compiler/c2/cr7005594/Test7005594.java
bmoloden
parents:
diff
changeset
|
35 |
|
5495adce1e0d
8170464: Remove shell script from compiler/c2/cr7005594/Test7005594.java
bmoloden
parents:
diff
changeset
|
36 |
public class Test7005594 { |
5495adce1e0d
8170464: Remove shell script from compiler/c2/cr7005594/Test7005594.java
bmoloden
parents:
diff
changeset
|
37 |
static int test(byte a[]){ |
5495adce1e0d
8170464: Remove shell script from compiler/c2/cr7005594/Test7005594.java
bmoloden
parents:
diff
changeset
|
38 |
int result = 0; |
5495adce1e0d
8170464: Remove shell script from compiler/c2/cr7005594/Test7005594.java
bmoloden
parents:
diff
changeset
|
39 |
for (int i = 1; i < a.length; i += Integer.MAX_VALUE) { |
5495adce1e0d
8170464: Remove shell script from compiler/c2/cr7005594/Test7005594.java
bmoloden
parents:
diff
changeset
|
40 |
result += a[i]; |
5495adce1e0d
8170464: Remove shell script from compiler/c2/cr7005594/Test7005594.java
bmoloden
parents:
diff
changeset
|
41 |
} |
5495adce1e0d
8170464: Remove shell script from compiler/c2/cr7005594/Test7005594.java
bmoloden
parents:
diff
changeset
|
42 |
return result; |
5495adce1e0d
8170464: Remove shell script from compiler/c2/cr7005594/Test7005594.java
bmoloden
parents:
diff
changeset
|
43 |
} |
5495adce1e0d
8170464: Remove shell script from compiler/c2/cr7005594/Test7005594.java
bmoloden
parents:
diff
changeset
|
44 |
|
5495adce1e0d
8170464: Remove shell script from compiler/c2/cr7005594/Test7005594.java
bmoloden
parents:
diff
changeset
|
45 |
public static void main(String [] args){ |
5495adce1e0d
8170464: Remove shell script from compiler/c2/cr7005594/Test7005594.java
bmoloden
parents:
diff
changeset
|
46 |
try { |
5495adce1e0d
8170464: Remove shell script from compiler/c2/cr7005594/Test7005594.java
bmoloden
parents:
diff
changeset
|
47 |
int result = test(new byte[2]); |
5495adce1e0d
8170464: Remove shell script from compiler/c2/cr7005594/Test7005594.java
bmoloden
parents:
diff
changeset
|
48 |
throw new AssertionError("Expected ArrayIndexOutOfBoundsException was not thrown"); |
5495adce1e0d
8170464: Remove shell script from compiler/c2/cr7005594/Test7005594.java
bmoloden
parents:
diff
changeset
|
49 |
} catch (ArrayIndexOutOfBoundsException e) { |
5495adce1e0d
8170464: Remove shell script from compiler/c2/cr7005594/Test7005594.java
bmoloden
parents:
diff
changeset
|
50 |
System.out.println("Expected " + e + " was thrown"); |
5495adce1e0d
8170464: Remove shell script from compiler/c2/cr7005594/Test7005594.java
bmoloden
parents:
diff
changeset
|
51 |
} |
5495adce1e0d
8170464: Remove shell script from compiler/c2/cr7005594/Test7005594.java
bmoloden
parents:
diff
changeset
|
52 |
} |
5495adce1e0d
8170464: Remove shell script from compiler/c2/cr7005594/Test7005594.java
bmoloden
parents:
diff
changeset
|
53 |
} |