[Bug libgcj/17020] New: gij should ignore all reserved method flags

greenrd at greenrd dot org gcc-bugzilla@gcc.gnu.org
Fri Aug 13 17:17:00 GMT 2004


The JVM spec says, in section 4.6 relating to method access flags:

"All bits of the access_flags item not assigned in Table 4.5 are reserved for
future use. They should be set to zero in generated class files and should be
ignored by Java virtual machine implementations." [0]

However, gij does not follow this spec. It contains this code in
libjava/defineclass.cc :

  1253        if (method->accflags & (Modifier::VOLATILE
  1254                                | Modifier::TRANSIENT
  1255                                | Modifier::INTERFACE))
  1256          throw_class_format_error ("erroneous method access flags");

This becomes a problem when a method using covariant return types is compiled by
JDK 1.5 beta, passed through Retroweaver[1] to make it "Java
1.4-bytecode-compatible", and then run by gij - because Retroweaver
sometimes/always leaves the undocumented 0x40 flag set for covariant bridge
methods. (0x40 is interpreted by gcj as VOLATILE, but 0x40 is not in Table 4.5
in the spec, so it should not be rejected by gij.)

Although probably Retroweaver shouldn't do that (and I'll file a bug against
Retroweaver about that), gij should still accept it when it does.

[0] http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html#1513
[1] http://retroweaver.sourceforge.net/

-- 
           Summary: gij should ignore all reserved method flags
           Product: gcc
           Version: 3.4.1
            Status: UNCONFIRMED
          Severity: minor
          Priority: P2
         Component: libgcj
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: greenrd at greenrd dot org
                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=17020



More information about the Gcc-bugs mailing list