public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: java/7912: invalid verification error for arrays
@ 2002-11-23  0:26 tromey
  0 siblings, 0 replies; 3+ messages in thread
From: tromey @ 2002-11-23  0:26 UTC (permalink / raw)
  To: ebb9, gcc-bugs, gcc-prs, java-prs, tromey

Synopsis: invalid verification error for arrays

State-Changed-From-To: analyzed->closed
State-Changed-By: tromey
State-Changed-When: Mon Nov 18 10:10:32 2002
State-Changed-Why:
    I'm checking in the fix.
    Thanks for the report.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7912


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: java/7912: invalid verification error for arrays
@ 2002-11-03 16:42 tromey
  0 siblings, 0 replies; 3+ messages in thread
From: tromey @ 2002-11-03 16:42 UTC (permalink / raw)
  To: ebb9, gcc-bugs, gcc-prs, java-prs, nobody, tromey

Synopsis: invalid verification error for arrays

Responsible-Changed-From-To: unassigned->tromey
Responsible-Changed-By: tromey
Responsible-Changed-When: Sun Nov  3 16:42:48 2002
Responsible-Changed-Why:
    I'm handling this
State-Changed-From-To: open->analyzed
State-Changed-By: tromey
State-Changed-When: Sun Nov  3 16:42:48 2002
State-Changed-Why:
    I have a patch I'm testing.
    It turns out that the bytecode front end doesn't know
    that arrays implement Cloneable and Serializable.
    An even simpler test will cause an erroneous error.
    I'll check in a test case shortly.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7912


^ permalink raw reply	[flat|nested] 3+ messages in thread

* java/7912: invalid verification error for arrays
@ 2002-09-13 14:56 Eric Blake
  0 siblings, 0 replies; 3+ messages in thread
From: Eric Blake @ 2002-09-13 14:56 UTC (permalink / raw)
  To: gcc-gnats


>Number:         7912
>Category:       java
>Synopsis:       invalid verification error for arrays
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Fri Sep 13 14:56:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Eric Blake
>Release:        3.1 20020501 (prerelease)
>Organization:
>Environment:
System: Linux quaffle 2.4.9-31smp #1 SMP Tue Feb 26 06:55:00 EST 2002 i686 unknown
Architecture: i686

	
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../gcc/configure --enable-languages=c,c++,java --prefix=/fpga3/users/eblake/gcc
>Description:
	
The bytecode verifier is choking on legal widening casts from
multi-dimensioned arrays to smaller dimensions of Cloneable or
Serializable.  However, it is correctly allowing similar casts to
arrays of Object.  This is also a recently discovered bug in Sun's VM
verifier.

It appears to be a problem for verifying putstatic, putfield,
invokestatic, invokespecial, invokevirtual, and invokeinterface, but
not with checkcast or instanceof.
>How-To-Repeat:
	<When reporting a compiler error, preprocessor output must be
	included>
$ cat Foo.java
class Foo
{
  static Cloneable[] c;
  public static void main(String[] args)
  {
    c = new int[1][][];
  }
}
$ gcj -C Foo.java
$ gcj -o Foo --main=Foo Foo.class
Foo.java: In class `Foo':
Foo.java: In method `Foo.main(java.lang.String[])':
Foo.java:6: verification error at PC=11
Foo.java:6: expected type 'java.lang.Cloneable[]' but stack contains 'int[][][]'
$ sed -e "s/Cloneable/Object/" Foo.java > Foo1.java
$ mv Foo1.java Foo.java
$ gcj -C Foo.java
$ gcj -o Foo --main=Foo Foo.class
$
>Fix:
	
In the user code, create a temporary Object variable to widen the
original array into, then downcast that variable to the desired
Cloneable[] or Serializable[]. That forces the bytecode compiler to
use the checkcast bytecode, which passes verification.
    Object o = new int[1][][];
    c = (Cloneable[]) o;
>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-11-18 18:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-11-23  0:26 java/7912: invalid verification error for arrays tromey
  -- strict thread matches above, loose matches on Subject: below --
2002-11-03 16:42 tromey
2002-09-13 14:56 Eric Blake

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).