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

REGRESSION: Compiler assertion failure with forward reference

XMLWordPrintable

    • rc
    • x86
    • linux, windows_2000



      Name: nt126004 Date: 06/26/2002


      FULL PRODUCT VERSION :
      java version "1.4.1-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-beta-b14)
      Java HotSpot(TM) Client VM (build 1.4.1-beta-b14, mixed mode)


      FULL OPERATING SYSTEM VERSION :

      $ rpm -query glibc
      glibc-2.2.4-19.3
      $ uname -a
      Linux quaffle 2.4.9-31smp #1 SMP Tue Feb 26 06:55:00 EST
      2002 i686 unknown
      $ ls /etc/*release
      /etc/redhat-release

      ADDITIONAL OPERATING SYSTEMS :

      OS independent - all platforms affected

      A DESCRIPTION OF THE PROBLEM :
      The javac compiler fails with an assertion failure and stack
      trace when compiling the simple valid class file below. This
      is worse than the behavior in 1.3.1 and 1.4.0, where the
      compiler incorrectly rejected the file, but at least did not
      give a stack trace.

      REGRESSION. Last worked in version 1.4

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Compile the valid sample file ('javac Foo.java'). There
      should be no errors.
      2. For verification that the bug is fixed, the output of
      'java Foo' should be "1".

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      The file is valid - it is legal to make a simple assignment
      to j before j is declared; this assignment also happens to
      satisfy the necessary assignment to the blank final before
      class initialization is complete.

      In trying to make forward field assignment work (see bug
      4459133), this case was made even worse.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      An exception has occurred in the compiler (1.4.1-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.AssertionError
              at com.sun.tools.javac.v8.util.Bits.incl(Bits.java:73)
              at com.sun.tools.javac.v8.comp.Flow.letInit(Flow.java:181)
              at com.sun.tools.javac.v8.comp.Flow.letInit(Flow.java:199)
              at com.sun.tools.javac.v8.comp.Flow.visitAssign(Flow.java:930)
              at com.sun.tools.javac.v8.tree.Tree$Assign.accept(Tree.java:959)
              at com.sun.tools.javac.v8.comp.Flow.analyze(Flow.java:409)
              at com.sun.tools.javac.v8.comp.Flow.analyzeExpr(Flow.java:428)
              at com.sun.tools.javac.v8.comp.Flow.visitVarDef(Flow.java:616)
              at com.sun.tools.javac.v8.tree.Tree$VarDef.accept(Tree.java:514)
              at com.sun.tools.javac.v8.comp.Flow.analyze(Flow.java:409)
              at com.sun.tools.javac.v8.comp.Flow.analyzeDef(Flow.java:468)
              at com.sun.tools.javac.v8.comp.Flow.visitClassDef(Flow.java:526)
              at com.sun.tools.javac.v8.tree.Tree$ClassDef.accept(Tree.java:446)
              at com.sun.tools.javac.v8.comp.Flow.analyze(Flow.java:409)
              at com.sun.tools.javac.v8.comp.Flow.analyzeDef(Flow.java:468)
              at com.sun.tools.javac.v8.comp.Flow.analyzeTree(Flow.java:1041)
              at com.sun.tools.javac.v8.JavaCompiler.compile(JavaCompiler.java:367)
              at com.sun.tools.javac.v8.Main.compile(Main.java:523)
              at com.sun.tools.javac.Main.compile(Main.java:39)
              at com.sun.tools.javac.Main.main(Main.java:30)


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      class Foo {
        static int i = j = 1;
        static final int j;
        public static void main(String[] args) {
          System.out.print(j);
        }
      }
      ---------- END SOURCE ----------

      CUSTOMER WORKAROUND :
      Give the listing for j before attempting to assign it.
      (Review ID: 158521)
      ======================================================================

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: