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

verifier rejects method ending in switch instruction

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • None
    • 7, 8, 11, 17, 21, 24, 25
    • hotspot
    • None

      I believe the following method is valid:

      private Method "foo":"()V"
          stack 1 locals 1
      {
              goto L1;
      L3:
              stack_frame_type same;
              return;
      L1:
              stack_frame_type same;
              iconst_0;
              lookupswitch{
              default: L3 };
      }

      but the verifier doesn't like a method that ends in a switch instruction, even though it behaves like a goto:

      TEST RESULT: Failed. Execution failed: `main' threw exception: java.lang.VerifyError: Bad instruction Exception Details: Location: MethodEndsWithSwitch.foo()V @5: lookupswitch Reason: Error exists in the bytecode Bytecode: 0000000: a700 04b1 03ab 0000 ffff fffe 0000 0000 0000010: Stackmap Table: same_frame(@3) same_frame(@4)

            Unassigned Unassigned
            dlong Dean Long
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: