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

Logical operation on type long fails

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Cannot Reproduce
    • Affects Version/s: 8u231
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:
    • CPU:
      x86_64
    • OS:
      windows_10

      Description

      ADDITIONAL SYSTEM INFORMATION :
      Java(TM) SE Runtime Environment (build 1.8.0_231-b11)

      A DESCRIPTION OF THE PROBLEM :
      The logical & operation fails on type long;


      REGRESSION : Last worked in version 8

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      use code:
      long x = -1;
      x&= 0xFF;

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      x should now contain value 255
      the same operation on type int and short do give the correct value of 255;
      ACTUAL -
      Result is -1

      ---------- BEGIN SOURCE ----------
      long x = -1;
      x&= 0xFF;
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Don't use long variables in combination with logical operators

      FREQUENCY : always


        Attachments

          Activity

            People

            • Assignee:
              michaelm Michael McMahon
              Reporter:
              webbuggrp Webbug Group
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: