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

out of memory caused by big "case" values

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      1.2fcs
    • CPU:
      sparc
    • OS:
      solaris_2.5.1
    • Verification:
      Verified

      Description



      Name: laC46010 Date: 07/16/98



      Java compiler (1.2fcsB, solaris, x86) runs out of memory while trying
      to compile switch statment with boundary integer values in case
      statments. This bug appears due the usage of constants from
      (-2147483648 ,-2147483643) negative constant range or
      (2147483647,2147483643) positive constant range with any other constants.
      This test also injures 1.2beta4 compiler version,
      but bug absent in 1.2beta3 and 1.1.x versions.
      JLS 14.9 say:
      "Case labels are said to be associated with the switch statement, as
      are the values of the constant expressions (15.27) in the case
      labels... "
      Here all case expressions are allowable and compiler should
      not run out of memory.


      An example and compiler diagnostics follow:
      -------------------------------------------------------
      public class stmt03505 {

         public static void main(String argv[]) {
            System.exit(run() + 95/*STATUS_TEMP*/);
         }
         public static int run() {

            try {
                switch ( 0 ) {
                    case 0:
                    case 1 - (1<<31):
                    case (1<<31):
                }
                return 0;/*STATUS_PASSED*/
            } catch( OutOfMemoryError e) {
                return 2;/*STATUS_FAILED*/
            }
         }
      }

      novo35% uname -a
      SunOS novo35 5.5.1 Generic_103640-12 sun4m sparc SUNW,SPARCstation-20
      novo35% javac stmt03505.java
      The compiler has run out of memory. Consider using the "-J-mx<number>" command line option to increase the maximum heap size.
      novo91% uname -a
      SunOS novo91 5.6 Generic i86pc i386 i86pc
      novo91% javac -J-mx256m stmt03505.java
      The compiler has run out of memory. Consider using the "-J-mx<number>" command line option to increase the maximum heap size.
      -------------------------------------------------------

      ======================================================================

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              tturnidgsunw Todd Turnidge (Inactive)
              Reporter:
              leosunw Leo Leo (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: