test/tools/javac/BranchToFewerDefines.java

Fri, 09 Jan 2015 15:50:22 +0000

author
mcimadamore
date
Fri, 09 Jan 2015 15:50:22 +0000
changeset 3852
f02d967ddce2
permissions
-rw-r--r--

8067429: java.lang.VerifyError: Inconsistent stackmap frames at branch target
Summary: bitset for alive variables contains info about variables out of range
Reviewed-by: mcimadamore
Contributed-by: srikanth.adayapalam@oracle.com

mcimadamore@3852 1 /*
mcimadamore@3852 2 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
mcimadamore@3852 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
mcimadamore@3852 4 *
mcimadamore@3852 5 * This code is free software; you can redistribute it and/or modify it
mcimadamore@3852 6 * under the terms of the GNU General Public License version 2 only, as
mcimadamore@3852 7 * published by the Free Software Foundation.
mcimadamore@3852 8 *
mcimadamore@3852 9 * This code is distributed in the hope that it will be useful, but WITHOUT
mcimadamore@3852 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
mcimadamore@3852 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
mcimadamore@3852 12 * version 2 for more details (a copy is included in the LICENSE file that
mcimadamore@3852 13 * accompanied this code).
mcimadamore@3852 14 *
mcimadamore@3852 15 * You should have received a copy of the GNU General Public License version
mcimadamore@3852 16 * 2 along with this work; if not, write to the Free Software Foundation,
mcimadamore@3852 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
mcimadamore@3852 18 *
mcimadamore@3852 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
mcimadamore@3852 20 * or visit www.oracle.com if you need additional information or have any
mcimadamore@3852 21 * questions.
mcimadamore@3852 22 */
mcimadamore@3852 23
mcimadamore@3852 24 /*
mcimadamore@3852 25 * @test
mcimadamore@3852 26 * @bug 8067429
mcimadamore@3852 27 * @summary java.lang.VerifyError: Inconsistent stackmap frames at branch target
mcimadamore@3852 28 * @author srikanth
mcimadamore@3852 29 *
mcimadamore@3852 30 * @compile BranchToFewerDefines.java
mcimadamore@3852 31 * @run main BranchToFewerDefines
mcimadamore@3852 32 */
mcimadamore@3852 33
mcimadamore@3852 34 public class BranchToFewerDefines {
mcimadamore@3852 35 public static void main(String[] args) {
mcimadamore@3852 36 }
mcimadamore@3852 37 private void problematicMethod(int p) {
mcimadamore@3852 38 switch (p) {
mcimadamore@3852 39 case 3:
mcimadamore@3852 40 long n;
mcimadamore@3852 41 while (true) {
mcimadamore@3852 42 if (false) {
mcimadamore@3852 43 break;
mcimadamore@3852 44 }
mcimadamore@3852 45 }
mcimadamore@3852 46 break;
mcimadamore@3852 47 case 2:
mcimadamore@3852 48 loop: while (true) {
mcimadamore@3852 49 while (true) {
mcimadamore@3852 50 int i = 4;
mcimadamore@3852 51 if (p != 16) {
mcimadamore@3852 52 return;
mcimadamore@3852 53 }
mcimadamore@3852 54 break loop;
mcimadamore@3852 55 }
mcimadamore@3852 56 }
mcimadamore@3852 57 break;
mcimadamore@3852 58 default:
mcimadamore@3852 59 while (true) {
mcimadamore@3852 60 if (false) {
mcimadamore@3852 61 break;
mcimadamore@3852 62 }
mcimadamore@3852 63 }
mcimadamore@3852 64 break;
mcimadamore@3852 65 }
mcimadamore@3852 66 long b;
mcimadamore@3852 67 if (p != 7) {
mcimadamore@3852 68 switch (p) {
mcimadamore@3852 69 case 1:
mcimadamore@3852 70 long a = 17;
mcimadamore@3852 71 break;
mcimadamore@3852 72 case 2:
mcimadamore@3852 73 break;
mcimadamore@3852 74 default:
mcimadamore@3852 75 break;
mcimadamore@3852 76 }
mcimadamore@3852 77 }
mcimadamore@3852 78 }
mcimadamore@3852 79 private void problematicMethod2(int p) {
mcimadamore@3852 80 switch (p) {
mcimadamore@3852 81 case 3:
mcimadamore@3852 82 long n;
mcimadamore@3852 83 {
mcimadamore@3852 84 int i = 4;
mcimadamore@3852 85 break;
mcimadamore@3852 86 }
mcimadamore@3852 87 case 2:
mcimadamore@3852 88 {
mcimadamore@3852 89 int i = 4;
mcimadamore@3852 90 break;
mcimadamore@3852 91 }
mcimadamore@3852 92 default:
mcimadamore@3852 93 {
mcimadamore@3852 94 int i = 4;
mcimadamore@3852 95 break;
mcimadamore@3852 96 }
mcimadamore@3852 97 }
mcimadamore@3852 98 long b;
mcimadamore@3852 99 if (p != 7) {
mcimadamore@3852 100 switch (p) {
mcimadamore@3852 101 case 1:
mcimadamore@3852 102 long a = 17;
mcimadamore@3852 103 break;
mcimadamore@3852 104 case 2:
mcimadamore@3852 105 break;
mcimadamore@3852 106 default:
mcimadamore@3852 107 break;
mcimadamore@3852 108 }
mcimadamore@3852 109 }
mcimadamore@3852 110 }
mcimadamore@3852 111 }

mercurial