This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug java/19834] New: Eclipse bytecode miscompiled with -O --indirect-dispatch


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]