public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: Andreas Lenz <andreas.lenz@handy-games.com>
To: gcc-gnats@gcc.gnu.org
Subject: java/5361: gcj bug
Date: Fri, 11 Jan 2002 10:16:00 -0000	[thread overview]
Message-ID: <200201111809.g0BI94e09824@Twisty.local> (raw)


>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:


             reply	other threads:[~2002-01-11 18:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-01-11 10:16 Andreas Lenz [this message]
2002-01-11 10:26 Alexandre Petit-Bianco
2002-01-11 10:56 Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200201111809.g0BI94e09824@Twisty.local \
    --to=andreas.lenz@handy-games.com \
    --cc=gcc-gnats@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).