From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12563 invoked by alias); 11 Jan 2002 18:16:07 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 12489 invoked by uid 71); 11 Jan 2002 18:16:03 -0000 Resent-Date: 11 Jan 2002 18:16:02 -0000 Resent-Message-ID: <20020111181602.12488.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-To: nobody@gcc.gnu.org Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org, java-prs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, Andreas Lenz Received:(qmail 5864 invoked from network); 11 Jan 2002 18:09:07 -0000 Received: from unknown (HELO Twisty.local) (217.84.42.241) by sources.redhat.com with SMTP; 11 Jan 2002 18:09:07 -0000 Received: (from bosk@localhost) by Twisty.local (8.11.2/8.11.2/SuSE Linux 8.11.1-0.5) id g0BI94e09824; Fri, 11 Jan 2002 19:09:04 +0100 Message-Id:<200201111809.g0BI94e09824@Twisty.local> Date: Fri, 11 Jan 2002 10:16:00 -0000 From: Andreas Lenz To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version:3.113 Subject: java/5361: gcj bug X-SW-Source: 2002-01/txt/msg00432.txt.bz2 List-Id: >Number: 5361 >Category: java >Synopsis: ArrayIndexOutOfBounds where it should not be >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: wrong-code >Submitter-Id: net >Arrival-Date: Fri Jan 11 10:16:01 PST 2002 >Closed-Date: >Last-Modified: >Originator: >Release: 3.0.3 >Organization: >Environment: System: Linux Twisty 2.4.0 #5 Mit Mai 30 16:05:26 CEST 2001 i686 unknown Architecture: i686 host: i686-pc-linux-gnu build: i686-pc-linux-gnu target: i686-pc-linux-gnu configured with: ./configure >Description: java code: public void function(byte[] dst,...) { int tmp; byte dst_byte; ... copmuting tmp, tmp is in range 0x0000 to 0xffff ... // here is // dst.length = 2 // dst_byte = 0 dst[dst_byte] |= (tmp>>8); << (1) works dst[++dst_byte] |= (tmp & 0xff); << (2) dst_byte is now 2 !! } compiled with kaffe javac fails ! compiled with sun javac works ! changing (2) to ++dst_byte;dst[dst_byte] != (tmp & 0xff); works ! dst_byte changes from 0 to 2 this also happens, if the array has more elements, the last access fails, if dst.length == 5 dst_byte switches from 4 to 6 !! The code is executed in a modified, commercial java2 MicroEdition I'm not sure, if the gcj is correct and the bug is in the VM, as the bug also occurs with the kaffe compiler Well, I think the bug is most likely in the VM, but strange nevertheless... Best Regards Andi >How-To-Repeat: repeats every time >Fix: >Release-Note: >Audit-Trail: >Unformatted: