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

(verifier) VerifyError for switch statements with large constants

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.2.0, 1.3.0
    • hotspot
    • generic, x86
    • generic, linux



      Name: krT82822 Date: 03/24/99


      Programs that have switch statements that use "very large"
      constants compile fine, but then fail in the verifier. Here
      is a code sample:

      public class test2 {
      public void foo() {
      int x = 0;
      switch (x) {
      case 2147483548:
      System.out.println("asdf");
      break;
      }
      }

      public static void main(String[] args) {
      new test2().foo();
      }
      }
      (Review ID: 56041)
      ======================================================================

      Name: krC82822 Date: 03/22/2001


      java version "1.3.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0)
      Java HotSpot(TM) Client VM (build 1.3.0, mixed mode)
      ...and
      java version "1.4.0-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta-b56)
      Java HotSpot(TM) Client VM (build 1.4-beta-B56, mixed mode)
      -------------

      After compiling code containing a switch statement with at least 3 cases and
      with all of the values strictly greater than 0x7fff0000, the JVM complains about
      the generated code, claiming that it contains an illegal opcode:

      Exception in thread "main" java.lang.VerifyError: (class: foo2, method: main
      signature: ([Ljava/lang/String;)V) Illegal instruction found at offset 3

      public class foo2 {
          static void main(String args[]) {
              int i=0;
              switch(i) {
                  case 0x7fff0003: System.out.println("foo");
                  case 0x7fff0002: System.out.println("bar");
                  case 0x7fff0001: System.out.println("baz");
              }
          }
      };
      (Review ID: 119312)
      ======================================================================

            wtaosunw Wei Tao (Inactive)
            kryansunw Kevin Ryan (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: