From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17502 invoked by alias); 14 Sep 2004 05:48: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 17480 invoked by uid 48); 14 Sep 2004 05:48:34 -0000 Date: Tue, 14 Sep 2004 05:48:00 -0000 From: "ovidr at users dot sourceforge dot net" To: gcc-bugs@gcc.gnu.org Message-ID: <20040914054831.17474.ovidr@users.sourceforge.net> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug java/17474] New: [4.0 Regression] Compiling at -01 yields different results X-Bugzilla-Reason: CC X-SW-Source: 2004-09/txt/msg01496.txt.bz2 List-Id: Thread model: win32 gcc version 4.0.0 20040913 (experimental) gcj --main=codes codes.java (works) gcj -O1 --main=codes codes.java (gives different results) class codes { static int[] lengths; static int[] codeValues; public static void main(String[] args) { lengths = new int[] {6,0,0,7,5,5,4,5,4,4,4,3,3,3,3,4,4,7,0}; codeValues = new int[lengths.length]; for (int i = 0; i < codeValues.length; i++) { codeValues[i] = i; } // Sort the values. Primary key is code size. Secondary key is value. for (int i = 0; i < lengths.length - 1; i++) { for (int j = i + 1; j < lengths.length; j++) { if (lengths[j] < lengths[i] || (lengths[j] == lengths[i] && codeValues[j] < codeValues[i])) { int tmp; tmp = lengths[j]; lengths[j] = lengths[i]; lengths[i] = tmp; tmp = codeValues[j]; codeValues[j] = codeValues[i]; codeValues[i] = tmp; } } } int[] codes = new int[lengths.length]; int lastLength = 0; int code = 0; for (int i = 0; i < lengths.length; i++) { while (lastLength != lengths[i]) { lastLength++; code <<= 1; System.out.println("SET CODE: " + code); } if (lastLength != 0) { codes[i] = code; System.out.println("(Should be equal) SET CODES[" + i + "] = " + code + " = " + codes[i]); code++; } } } } -- Summary: [4.0 Regression] Compiling at -01 yields different results Product: gcc Version: 4.0.0 Status: UNCONFIRMED Severity: normal Priority: P2 Component: java AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: ovidr at users dot sourceforge dot net CC: gcc-bugs at gcc dot gnu dot org,java-prs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17474