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

Instruction doesn't increment correctly

    Details

    • Subcomponent:
    • CPU:
      x86_64
    • OS:
      windows_10

      Description

      ADDITIONAL SYSTEM INFORMATION :
      Windows 10 1803 version, i7-4720HQ/8GB Ram.

      A DESCRIPTION OF THE PROBLEM :
      The problem is when trying to increment and subtract/add in one line. It gives out wrong result.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Just copy the code from "Source code for an executable test case" and execute.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      X variable should give 3 and Y 10
      ACTUAL -
      X variable result is 2 not 3, and Y is 10.

      ---------- BEGIN SOURCE ----------
      {
          int x, y;
              {
                  int i = 5;
                  x = (i++) - 3;
                  y = i + 4;
              }
          }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      The only workaround i see is incrementing variable "i" before "x", and with that it'll give 3.

      FREQUENCY : always


        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: