This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug java/19834] New: Eclipse bytecode miscompiled with -O --indirect-dispatch
- From: "mckinlay at redhat dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 9 Feb 2005 03:20:55 -0000
- Subject: [Bug java/19834] New: Eclipse bytecode miscompiled with -O --indirect-dispatch
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
The following test case gets miscompiled from bytecode with "-O
--indirect-dispatch". It doesn't appear to matter which compiler produced the
bytecode - the same error occurs with all of them.
import java.util.*;
public class Test
{
static int i = 0;
static int get()
{
return i++;
}
public static void main(String[] args) throws Exception
{
ArrayList headerElements = new ArrayList();
while (true)
{
headerElements.add("");
if (get() == 13)
break;
}
int size = headerElements.size();
if (size == 0)
return;
System.out.println(size);
System.out.println(headerElements.size());
}
}
$ gcj Test.java -O --indirect-dispatch --main=Test
$ ./a.out
14
14
$ gcj -C Test.java; gcj Test.class -O --indirect-dispatch --main=Test
$ ./a.out
1
14
--
Summary: Eclipse bytecode miscompiled with -O --indirect-dispatch
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P2
Component: java
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: mckinlay at redhat dot com
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=19834