← Back to team overview

openjdk team mailing list archive

[Bug 601266] [NEW] right shift math errors: 1>>32 = 1

 

Public bug reported:

the right shift operator produces wrong results when shifting ints by 32
bits.

Description:	Ubuntu 9.04
Release:	9.04

 openjdk-6-jre                     6b14-1.4.1-0ubuntu13

Linux cryptovide-dev 2.6.28-18-generic #60-Ubuntu SMP Fri Mar 12
04:26:47 UTC 2010 x86_64 GNU/Linux

java version "1.6.0_0"
OpenJDK Runtime Environment (IcedTea6 1.4.1) (6b14-1.4.1-0ubuntu13)
OpenJDK 64-Bit Server VM (build 14.0-b08, mixed mode)

class Tmp {
    public static void main(String[] args) {
        System.out.println("1>>1 = "+(1>>1));
        System.out.println("1>>2 = "+(1>>2));
        System.out.println("1>>31 = "+(1>>31));
        System.out.println("1>>32 = "+(1>>32));
        System.out.println("1>>33 = "+(1>>33));
    }
}


1>>1 = 0
1>>2 = 0
1>>31 = 0
1>>32 = 1  <---------- should be 0
1>>33 = 0

** Affects: openjdk-6 (Ubuntu)
     Importance: Undecided
         Status: New

-- 
right shift math errors: 1>>32 = 1 
https://bugs.launchpad.net/bugs/601266
You received this bug notification because you are a member of OpenJDK,
which is subscribed to openjdk-6 in ubuntu.

Status in “openjdk-6” package in Ubuntu: New

Bug description:
the right shift operator produces wrong results when shifting ints by 32 bits. 

Description:	Ubuntu 9.04
Release:	9.04

 openjdk-6-jre                     6b14-1.4.1-0ubuntu13 

Linux cryptovide-dev 2.6.28-18-generic #60-Ubuntu SMP Fri Mar 12 04:26:47 UTC 2010 x86_64 GNU/Linux

java version "1.6.0_0"
OpenJDK Runtime Environment (IcedTea6 1.4.1) (6b14-1.4.1-0ubuntu13)
OpenJDK 64-Bit Server VM (build 14.0-b08, mixed mode)

class Tmp {
    public static void main(String[] args) {
        System.out.println("1>>1 = "+(1>>1));
        System.out.println("1>>2 = "+(1>>2));
        System.out.println("1>>31 = "+(1>>31));
        System.out.println("1>>32 = "+(1>>32));
        System.out.println("1>>33 = "+(1>>33));
    }
}


1>>1 = 0
1>>2 = 0
1>>31 = 0
1>>32 = 1  <---------- should be 0
1>>33 = 0





Follow ups

References