Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4934916

boxing versus array initializers crashes javac

XMLWordPrintable

    • b35
    • generic, x86, sparc
    • generic, linux, solaris_2.5, solaris_8, windows_nt, windows_2000, windows_xp

      $NewArray.accept(Tree.java:848)
               at com.sun.tools.javac.jvm.Gen.genExpr(Gen.java:801)
               at com.sun.tools.javac.jvm.Gen.genArgs(Gen.java:819)
               at com.sun.tools.javac.jvm.Gen.visitApply(Gen.java:1648)
               at com.sun.tools.javac.tree.Tree$Apply.accept(Tree.java:808)
               at com.sun.tools.javac.jvm.Gen.genExpr(Gen.java:801)
               at com.sun.tools.javac.jvm.Gen.visitExec(Gen.java:1596)
               at com.sun.tools.javac.tree.Tree$Exec.accept(Tree.java:725)
               at com.sun.tools.javac.jvm.Gen.genDef(Gen.java:648)
               at com.sun.tools.javac.jvm.Gen.genStat(Gen.java:683)
               at com.sun.tools.javac.jvm.Gen.genStat(Gen.java:669)
               at com.sun.tools.javac.jvm.Gen.genStats(Gen.java:720)
               at com.sun.tools.javac.jvm.Gen.visitBlock(Gen.java:967)
               at com.sun.tools.javac.tree.Tree$Block.accept(Tree.java:531)
               at com.sun.tools.javac.jvm.Gen.genDef(Gen.java:648)
               at com.sun.tools.javac.jvm.Gen.genStat(Gen.java:683)
               at com.sun.tools.javac.jvm.Gen.genMethod(Gen.java:905)
               at com.sun.tools.javac.jvm.Gen.visitMethodDef(Gen.java:841)
               at com.sun.tools.javac.tree.Tree$MethodDef.accept(Tree.java:473)
               at com.sun.tools.javac.jvm.Gen.genDef(Gen.java:648)
               at com.sun.tools.javac.jvm.Gen.genClass(Gen.java:2167)
               at com.sun.tools.javac.main.JavaCompiler.genCode(JavaCompiler.java:321)
               at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:460)
               at com.sun.tools.javac.main.Main.compile(Main.java:584)
               at com.sun.tools.javac.main.Main.compile(Main.java:536)
               at com.sun.tools.javac.Main.compile(Main.java:41)
               at com.sun.tools.javac.Main.main(Main.java:32)
      Error executing javac: F:\j2sdk1.5.0\bin\javac.exe
      @F:\DOKUME~1\GERNOT~1\LOKALE~1\Temp\jbldr12363tmp

      ========================================$ cat X.java
      class T {
          Integer[] a2 = { 0, 1, 2, 3 };
      }
      ========================================$ newjavac X.java
      + exec /usr/java1.5/bin/javac -J-esa -source 1.5 -target 1.4 X.java
      An exception has occurred in the compiler (1.5.0-internal). Please file a bug at the Java Developer Connection (http://java.sun.com/cgi-bin/bugreport.cgi) after checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report. Thank you.
      java.lang.ArrayIndexOutOfBoundsException: -1
      at com.sun.tools.javac.jvm.Code.emitop0(Code.java:545)
      at com.sun.tools.javac.jvm.Items$StackItem.duplicate(Items.java:271)
      at com.sun.tools.javac.jvm.Gen.visitNewArray(Gen.java:1709)
      at com.sun.tools.javac.tree.Tree$NewArray.accept(Tree.java:848)
      at com.sun.tools.javac.jvm.Gen.genExpr(Gen.java:801)
      at com.sun.tools.javac.jvm.Gen.visitAssign(Gen.java:1750)
      at com.sun.tools.javac.tree.Tree$Assign.accept(Tree.java:874)
      at com.sun.tools.javac.jvm.Gen.genExpr(Gen.java:801)
      at com.sun.tools.javac.jvm.Gen.visitExec(Gen.java:1603)
      at com.sun.tools.javac.tree.Tree$Exec.accept(Tree.java:725)
      at com.sun.tools.javac.jvm.Gen.genDef(Gen.java:648)
      at com.sun.tools.javac.jvm.Gen.genStat(Gen.java:683)
      at com.sun.tools.javac.jvm.Gen.genStat(Gen.java:669)
      at com.sun.tools.javac.jvm.Gen.genStats(Gen.java:720)
      at com.sun.tools.javac.jvm.Gen.visitBlock(Gen.java:967)
      at com.sun.tools.javac.tree.Tree$Block.accept(Tree.java:531)
      at com.sun.tools.javac.jvm.Gen.genDef(Gen.java:648)
      at com.sun.tools.javac.jvm.Gen.genStat(Gen.java:683)
      at com.sun.tools.javac.jvm.Gen.genMethod(Gen.java:905)
      at com.sun.tools.javac.jvm.Gen.visitMethodDef(Gen.java:841)
      at com.sun.tools.javac.tree.Tree$MethodDef.accept(Tree.java:473)
      at com.sun.tools.javac.jvm.Gen.genDef(Gen.java:648)
      at com.sun.tools.javac.jvm.Gen.genClass(Gen.java:2170)
      at com.sun.tools.javac.main.JavaCompiler.genCode(JavaCompiler.java:328)
      at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:467)
      at com.sun.tools.javac.main.Main.compile(Main.java:570)
      at com.sun.tools.javac.main.Main.compile(Main.java:518)
      at com.sun.tools.javac.Main.compile(Main.java:41)
      at com.sun.tools.javac.Main.main(Main.java:32)
      ========================================$

      Same problem reported by a CAP member:

      J2SE Version (please include all output from java -version flag):
        java version "1.5.0-beta"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b26)
        Java HotSpot(TM) Client VM (build 1.5.0-beta-b26, mixed mode)

      Does this problem occur on J2SE 1.4 or 1.4.1 or 1.4.2? Yes / No (pick one)
        NO

      Operating System Configuration Information (be specific):
        Windows NT 4.0 SP 6a and Windows XP Pro

      Hardware Configuration Information (be specific):
        Intel Pentium 4

      Bug Description:
        Compiler error when autoboxing primary values into a reference value array.

      Steps to Reproduce (be specific):
        public class TigerTest {

      // test autobox of primary values
      Integer[] array = new Integer[] { 1, 2 };
        }
      Compiler stack trace:
      An exception has occurred in the compiler (1.5.0-beta). Please file a bug at the Java Developer Connection (http://java.sun.com/cgi-bin/bugreport.cgi) after checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report. Thank you.
      java.lang.ArrayIndexOutOfBoundsException: -1
              at com.sun.tools.javac.jvm.Code$State.pop(Code.java:1499)
              at com.sun.tools.javac.jvm.Code$State.pop(Code.java:1505)
              at com.sun.tools.javac.jvm.Code.emitop2(Code.java:948)
              at com.sun.tools.javac.jvm.Items$MemberItem.store(Items.java:470)
              at com.sun.tools.javac.jvm.Items$AssignItem.drop(Items.java:662)
              at com.sun.tools.javac.jvm.Gen.visitExec(Gen.java:1596)
              at com.sun.tools.javac.tree.Tree$Exec.accept(Tree.java:725)
              at com.sun.tools.javac.jvm.Gen.genDef(Gen.java:648)
              at com.sun.tools.javac.jvm.Gen.genStat(Gen.java:683)
              at com.sun.tools.javac.jvm.Gen.genStat(Gen.java:669)
              at com.sun.tools.javac.jvm.Gen.genStats(Gen.java:720)
              at com.sun.tools.javac.jvm.Gen.visitBlock(Gen.java:967)
              at com.sun.tools.javac.tree.Tree$Block.accept(Tree.java:531)
              at com.sun.tools.javac.jvm.Gen.genDef(Gen.java:648)
              at com.sun.tools.javac.jvm.Gen.genStat(Gen.java:683)
              at com.sun.tools.javac.jvm.Gen.genMethod(Gen.java:905)
              at com.sun.tools.javac.jvm.Gen.visitMethodDef(Gen.java:841)
              at com.sun.tools.javac.tree.Tree$MethodDef.accept(Tree.java:473)
              at com.sun.tools.javac.jvm.Gen.genDef(Gen.java:648)
              at com.sun.tools.javac.jvm.Gen.genClass(Gen.java:2163)
              at com.sun.tools.javac.main.JavaCompiler.genCode(JavaCompiler.java:328)
              at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:467)
              at com.sun.tools.javac.main.Main.compile(Main.java:598)
              at com.sun.tools.javac.main.Main.compile(Main.java:546)
              at com.sun.tools.javac.Main.compile(Main.java:41)
              at com.sun.tools.javac.Main.main(Main.java:32)

      or

      public class TigerTest {

      public staitc void main(String[] args) {
      // test autobox of primary values
      Integer[] array = new Integer[] { 1, 2 };
      }

      }


      Compiler stack trace:

      An exception has occurred in the compiler (1.5.0-beta). Please file a bug at the Java Developer Connection (http://java.sun.com/cgi-bin/bugreport.cgi) after checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report. Thank you.
      java.lang.ArrayIndexOutOfBoundsException: -1
              at com.sun.tools.javac.jvm.Code.emitop0(Code.java:545)
              at com.sun.tools.javac.jvm.Items$StackItem.duplicate(Items.java:271)
              at com.sun.tools.javac.jvm.Gen.visitNewArray(Gen.java:1702)
              at com.sun.tools.javac.tree.Tree$NewArray.accept(Tree.java:848)
              at com.sun.tools.javac.jvm.Gen.genExpr(Gen.java:801)
              at com.sun.tools.javac.jvm.Gen.visitVarDef(Gen.java:954)
              at com.sun.tools.javac.tree.Tree$VarDef.accept(Tree.java:502)
              at com.sun.tools.javac.jvm.Gen.genDef(Gen.java:648)
              at com.sun.tools.javac.jvm.Gen.genStat(Gen.java:683)
              at com.sun.tools.javac.jvm.Gen.genStat(Gen.java:669)
              at com.sun.tools.javac.jvm.Gen.genStats(Gen.java:720)
              at com.sun.tools.javac.jvm.Gen.visitBlock(Gen.java:967)
              at com.sun.tools.javac.tree.Tree$Block.accept(Tree.java:531)
              at com.sun.tools.javac.jvm.Gen.genDef(Gen.java:648)
              at com.sun.tools.javac.jvm.Gen.genStat(Gen.java:683)
              at com.sun.tools.javac.jvm.Gen.genMethod(Gen.java:905)
              at com.sun.tools.javac.jvm.Gen.visitMethodDef(Gen.java:841)
              at com.sun.tools.javac.tree.Tree$MethodDef.accept(Tree.java:473)
              at com.sun.tools.javac.jvm.Gen.genDef(Gen.java:648)
              at com.sun.tools.javac.jvm.Gen.genClass(Gen.java:2163)
              at com.sun.tools.javac.main.JavaCompiler.genCode(JavaCompiler.java:328)
              at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:467)
              at com.sun.tools.javac.main.Main.compile(Main.java:598)
              at com.sun.tools.javac.main.Main.compile(Main.java:546)
              at com.sun.tools.javac.Main.compile(Main.java:41)
              at com.sun.tools.javac.Main.main(Main.java:32)

      ---------------------------------

      ###@###.### 2003-11-13

      one more cap member reports the same problem:

      J2SE Version (please include all output from java -version flag):
        java version "1.5.0-beta"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b26)
        Java HotSpot(TM) Client VM (build 1.5.0-beta-b26, mixed mode)

      Does this problem occur on J2SE 1.4 or 1.4.1 or 1.4.2? Yes / No (pick one)
        No.

      Operating System Configuration Information (be specific): Gentoo Linux
        1.4

      Hardware Configuration Information (be specific):
        Dell Inspiron 8200.

      Bug Description:
        The following code crashes the compiler with the source 1.5 option.
      //------------------------Main2.java----------------------------------

      import java.util.Arrays;
      import java.util.List;

      public class Main2
      {

              public static void main(String[] arguments)
              {
                      Integer[] integers = new Integer[]{1, 2, 3, 4};
                      List<Integer> list = Arrays.asList(integers);
              }

      }
      I believe it crashes will trying to generate code for the manifest
      array.

      //------------------------Main2.java----------------------------------
      javac -source 1.5 Main2.java
      An exception has occurred in the compiler (1.5.0-beta). Please file a
      bug at the Java Developer Connection
      (http://java.sun.com/cgi-bin/bugreport.cgi) after checking the Bug
      Parade for duplicates. Include your program and the following diagnostic
      in your report. Thank you.
      java.lang.ArrayIndexOutOfBoundsException: -1
              at com.sun.tools.javac.jvm.Code.emitop0(Code.java:545)
              at com.sun.tools.javac.jvm.Items$StackItem.duplicate(Items.java:271)
              at com.sun.tools.javac.jvm.Gen.visitNewArray(Gen.java:1702)
              at com.sun.tools.javac.tree.Tree$NewArray.accept(Tree.java:848)
              at com.sun.tools.javac.jvm.Gen.genExpr(Gen.java:801)
              at com.sun.tools.javac.jvm.Gen.visitVarDef(Gen.java:954)
              at com.sun.tools.javac.tree.Tree$VarDef.accept(Tree.java:502)
              at com.sun.tools.javac.jvm.Gen.genDef(Gen.java:648)
              at com.sun.tools.javac.jvm.Gen.genStat(Gen.java:683)
              at com.sun.tools.javac.jvm.Gen.genStat(Gen.java:669)
              at com.sun.tools.javac.jvm.Gen.genStats(Gen.java:720)
              at com.sun.tools.javac.jvm.Gen.visitBlock(Gen.java:967)
              at com.sun.tools.javac.tree.Tree$Block.accept(Tree.java:531)
              at com.sun.tools.javac.jvm.Gen.genDef(Gen.java:648)
              at com.sun.tools.javac.jvm.Gen.genStat(Gen.java:683)
              at com.sun.tools.javac.jvm.Gen.genMethod(Gen.java:905)
              at com.sun.tools.javac.jvm.Gen.visitMethodDef(Gen.java:841)
              at com.sun.tools.javac.tree.Tree$MethodDef.accept(Tree.java:473)
              at com.sun.tools.javac.jvm.Gen.genDef(Gen.java:648)
              at com.sun.tools.javac.jvm.Gen.genClass(Gen.java:2163)
              at com.sun.tools.javac.main.JavaCompiler.genCode(JavaCompiler.java:328)
              at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:467)
              at com.sun.tools.javac.main.Main.compile(Main.java:598)
              at com.sun.tools.javac.main.Main.compile(Main.java:546)
              at com.sun.tools.javac.Main.compile(Main.java:41)
              at com.sun.tools.javac.Main.main(Main.java:32)


      Steps to Reproduce (be specific):

      compile Main2.java with the -source 1.5 flag.
      javac -source 1.5 Main2.java


      ------------------------------------------------
      ###@###.### 2003-11-24

      One more CAP member reports the same problem:

      J2SE Version (please include all output from java -version flag):
        java version "1.5.0-beta"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b28)
        Java HotSpot(TM) Client VM (build 1.5.0-beta-b28, mixed mode)

      Does this problem occur on J2SE 1.4 or 1.4.1 or 1.4.2? Yes / No (pick one)
        No

      Operating System Configuration Information (be specific):
        Win XP

      Hardware Configuration Information (be specific):
        Dell Inspiron 8200

      Bug Description:
        Javac crashes when boxing is used in arrays

      Steps to Reproduce (be specific):
        Compile the following program with "javac -source 1.5"

      public class Test
      {
              public static void main(String[] args)
              {
                      Integer[] a = { 10 };
              }
      }



      Javac will crash with the following exception:

      An exception has occurred in the compiler (1.5.0-beta). Please file a
      bug at the Java Developer Connection
      (http://java.sun.com/cgi-bin/bugreport.cgi) after checking the Bug
      Parade for duplicates. Include your program and the following diagnostic
      in your report. Thank you.
      java.lang.ArrayIndexOutOfBoundsException: -1
              at com.sun.tools.javac.jvm.Code$State.pop(Code.java:1501)
              at com.sun.tools.javac.jvm.Code.emitop0(Code.java:514)
              at com.sun.tools.javac.jvm.Items$LocalItem.store(Items.java:382)
              at com.sun.tools.javac.jvm.Gen.visitVarDef(Gen.java:955)
              at com.sun.tools.javac.tree.Tree$VarDef.accept(Tree.java:502)
              at com.sun.tools.javac.jvm.Gen.genDef(Gen.java:648)
              at com.sun.tools.javac.jvm.Gen.genStat(Gen.java:683)
              at com.sun.tools.javac.jvm.Gen.genStat(Gen.java:669)
              at com.sun.tools.javac.jvm.Gen.genStats(Gen.java:720)
              at com.sun.tools.javac.jvm.Gen.visitBlock(Gen.java:967)
              at com.sun.tools.javac.tree.Tree$Block.accept(Tree.java:531)
              at com.sun.tools.javac.jvm.Gen.genDef(Gen.java:648)
              at com.sun.tools.javac.jvm.Gen.genStat(Gen.java:683)
              at com.sun.tools.javac.jvm.Gen.genMethod(Gen.java:905)
              at com.sun.tools.javac.jvm.Gen.visitMethodDef(Gen.java:841)
              at com.sun.tools.javac.tree.Tree$MethodDef.accept(Tree.java:473)
              at com.sun.tools.javac.jvm.Gen.genDef(Gen.java:648)
              at com.sun.tools.javac.jvm.Gen.genClass(Gen.java:2167)
              at com.sun.tools.javac.main.JavaCompiler.genCode(JavaCompiler.java:328)
              at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:467)
              at com.sun.tools.javac.main.Main.compile(Main.java:598)
              at com.sun.tools.javac.main.Main.compile(Main.java:546)
              at com.sun.tools.javac.Main.compile(Main.java:41)
              at com.sun.tools.javac.Main.main(Main.java:32)


      ###@###.### 2003-12-15

      One more:

      J2SE Version (please include all output from java -version flag):
        1.5.0-beta-b30

      Does this problem occur on J2SE 1.4 or 1.4.1 or 1.4.2? Yes / No (pick one)
        not possible (due to lack of varargs)

      Operating System Configuration Information (be specific):
        Windows 2000 SP 1

      Hardware Configuration Information (be specific):
        Pentium 2, 333 Mhz, 512MB RAM.

      Bug Description:
        Compiler crash while trying to compile invocation of varargs function
        with an object array as the only parameter.

      Steps to Reproduce (be specific):
        Compiler TestVarargs.java throws ArrayIndexOutOfBoundsException

      public class TestVarargs
      {
          static void foo(Object... args)
          {
            for(Object o : args)
              System.out.println(o.getClass().getName());
          }

          public void testArgs()
          {
            foo(42, "hello", 3.141); // this compiles
            foo(new Object[]{42, "hello", 3.141}); // this doesn't compile
          }


      }


      javac
         StdErr
            An exception has occurred in the compiler (1.5.0-beta). Please file a bug at the Java
      Developer Connection (http://java.sun.com/cgi-bin/bugreport.cgi) after checking the Bug Parade
      for duplicates. Include your program and the following diagnostic in your report. Thank you.
            java.lang.ArrayIndexOutOfBoundsException: -1
               at com.sun.tools.javac.jvm.Code.emitop0(Code.java:545)
               at com.sun.tools.javac.jvm.Items$StackItem.duplicate(Items.java:271)
               at com.sun.tools.javac.jvm.Gen.visitNewArray(Gen.java:1702)
               at com.sun.tools.javac.tree.Tree

            gafter Neal Gafter (Inactive)
            gafter Neal Gafter (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: