From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6358 invoked by alias); 21 Jan 2004 05:53:35 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 6351 invoked by uid 48); 21 Jan 2004 05:53:34 -0000 Date: Wed, 21 Jan 2004 05:53:00 -0000 From: "andrew dot gray at anu dot edu dot au" To: gcc-bugs@gcc.gnu.org Message-ID: <20040121055330.13788.andrew.gray@anu.edu.au> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug java/13788] New: Zero propogate right shift in static final int initializer causes error X-Bugzilla-Reason: CC X-SW-Source: 2004-01/txt/msg02524.txt.bz2 List-Id: Overview description -------------------- Using the zero propogate right shift operator (>>>) with constant operands in a static final int initializer causes a compilation error in gcj. Steps to reproduce ------------------ 1) Create the RShiftInInitializer.java source file with the following contents: class RShiftInIntInitializer { private static final int DUMMY1 = 1 >>> 1; public static void main(String [] args) { System.out.println(DUMMY1); } } 2) Run the following gcj command: gcj --main=RShiftInIntInitializer RShiftInIntInitializer.java Actual results -------------- The gcj command produced the following output: RShiftInIntInitializer.java: In class `RShiftInIntInitializer': RShiftInIntInitializer.java: In method `()': RShiftInIntInitializer.java:2: error: Incompatible type for declaration. Explicit cast needed to convert `unsigned int' to `int'. private static final int DUMMY1 = 1 >>> 1; ^ 1 error Expected results ---------------- I expect gcj to produce no error messages and create an a.out file that when run would produce the following output: 0 This is what happened when I used the javac and java tools from Sun's J2SE SDK v1.4.1 to compile and run the RShiftInInitializer.java code. Version and platform -------------------- Version of GCC: 3.4.0 20040114 (experimental) System type: i686-pc-linux-gnu Options given when GCC was configured: ../gcc-3.4-20040114/configure --prefix=/home/andrewg/gcc-3.4-20040114-install --enable-threads=posix --enable-shared --enable-languages=c++,java The problem was also seen with the following versions of GCC: 3.2.2 20030222 (Red Hat Linux 3.2.2-5) 3.3.2 -- Summary: Zero propogate right shift in static final int initializer causes error Product: gcc Version: 3.4.0 Status: UNCONFIRMED Severity: minor Priority: P2 Component: java AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: andrew dot gray at anu dot edu dot au CC: gcc-bugs at gcc dot gnu dot org GCC host triplet: i686-pc-linux-gnu GCC target triplet: i686-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13788