1 /*
   2  * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 /**
  26  * @test
  27  * @bug 7090976
  28  * @summary Eclipse/CDT causes a JVM crash while indexing C++ code
  29  *
  30  * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement
  31  *      compiler.c1.Test7090976
  32  */
  33 
  34 package compiler.c1;
  35 
  36 public class Test7090976 {
  37 
  38     static interface I1 {
  39         public void m1();
  40     };
  41 
  42     static interface I2 {
  43         public void m2();
  44     };
  45 
  46     static interface I extends I1,I2 {
  47     }
  48 
  49     static class A implements I1 {
  50         int v = 0;
  51         int v2;
  52 
  53         public void m1() {
  54             v2 = v;
  55         }
  56     }
  57 
  58     static class B implements I2 {
  59         Object v = new Object();
  60         Object v2;
  61 
  62         public void m2() {
  63             v2 = v;
  64         }
  65     }
  66 
  67     private void test(A a)
  68     {
  69         if (a instanceof I) {
  70             I i = (I)a;
  71             i.m1();
  72             i.m2();
  73         }
  74     }
  75 
  76     public static void main(String[] args)
  77     {
  78         Test7090976 t = new Test7090976();
  79         A a = new A();
  80         B b = new B();
  81         for (int i = 0; i < 10000; i++) {
  82             t.test(a);
  83         }
  84     }
  85 }