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

Multiple declarations in for statement do not compile correctly

    XMLWordPrintable

Details

    • 0.9internal
    • sparc
    • solaris_2.4
    • Not verified

    Description


      This program produces the wrong local variable index for x.

      class Test {
          public static void main(String argv[]) {
      for (int y = 0, yi = 0 ; y < 10 ; y++) {
      int x = 5;
      yi = y + yi + x;
      }
          }
      }

      Method void main(oak/lang/String [])
         0 iconst_0
         1 istore_1
         2 iconst_0
         3 istore_2
         4 goto 18
         7 iconst_5
         8 istore_1 <<= y
         9 iload_1 1
        10 iload_2 2 <<= yi
        11 iadd
        12 iload_1 1 <<= x
        13 iadd
        14 istore_2
        15 iinc 1 1
        18 iload_1 1
        19 bipush 10
        21 if_icmplt 7
        24 return

      Attachments

        Activity

          People

            ahoffsunw Arthur Hoff (Inactive)
            ahoffsunw Arthur Hoff (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: