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

array of values gets overwritten in each iteration.

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Not an Issue
    • Affects Version/s: 8
    • Fix Version/s: None
    • Component/s: core-libs
    • Subcomponent:
    • CPU:
      x86_64
    • OS:
      windows_10

      Description

      ADDITIONAL SYSTEM INFORMATION :
      java version "1.8.0_221"
      Java(TM) SE Runtime Environment (build 1.8.0_221-b11)
      Java HotSpot(TM) 64-Bit Server VM (build 25.221-b11, mixed mode)

      A DESCRIPTION OF THE PROBLEM :
      value = 7. returns all 6s in the buffer

      public int[][] xyz(int value){
      int[][] buff = new int[value][value];
      for (int z=0; z <value; z++)
      for (int y=0; y <value; y++)
      for (int x=0; x <value; x++){
      buff[x][y] = z;
      };
      return buff;
      }

      REGRESSION : Last worked in version 8u231

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      public int[][] xyz(int value){
      int[][] buff = new int[value][value];
      for (int z=0; z <value; z++)
      for (int y=0; y <value; y++)
      for (int x=0; x <value; x++){
      buff[x][y] = z;
      };
      return buff;
      }

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      A tensor of 0 to 6
      ACTUAL -
      returns all 6s in the buffer

      [006, 006, 006, 006, 006, 006, 006]
      [006, 006, 006, 006, 006, 006, 006]
      [006, 006, 006, 006, 006, 006, 006]
      [006, 006, 006, 006, 006, 006, 006]
      [006, 006, 006, 006, 006, 006, 006]
      [006, 006, 006, 006, 006, 006, 006]
      [006, 006, 006, 006, 006, 006, 006]

      ---------- BEGIN SOURCE ----------
      public int[][] xyz(int value){
      int[][] buff = new int[value][value];
      for (int z=0; z <value; z++)
      for (int y=0; y <value; y++)
      for (int x=0; x <value; x++){
      buff[x][y] = z;
      };
      return buff;
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Still looking for one. I've been experimenting with different permutations of the issue. for instance, if I use z-- it produces
      [-2147483616, -2147483623, -2147483630, -2147483637, -2147483644, 2147483645, 2147483638]
      [-2147483617, -2147483624, -2147483631, -2147483638, -2147483645, 2147483644, 2147483637]
      [-2147483618, -2147483625, -2147483632, -2147483639, -2147483646, 2147483643, 2147483636]
      [-2147483619, -2147483626, -2147483633, -2147483640, -2147483647, 2147483642, 2147483635]
      [-2147483620, -2147483627, -2147483634, -2147483641, -2147483648, 2147483641, 2147483634]
      [-2147483621, -2147483628, -2147483635, -2147483642, 2147483647, 2147483640, 2147483633]
      [-2147483622, -2147483629, -2147483636, -2147483643, 2147483646, 2147483639, 2147483632]

      FREQUENCY : always


        Attachments

          Activity

            People

            • Assignee:
              psonal Pallavi Sonal (Inactive)
              Reporter:
              webbuggrp Webbug Group
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: