This is the mail archive of the gcc-patches@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]

Patch: RFA: PR java/19929


This patch fixes PR java/19929.

I'm not sure how this code ever worked (though it did, as 3.3 doesn't
miscompile the test case).  Anyway the fix is to note the stack
effects of the multianewarray opcode we emit.

Tested on x86 FC2.  Ok?

Tom

Index: libjava/ChangeLog
from  Tom Tromey  <tromey@redhat.com>

	For PR java/19929:
	* testsuite/libjava.lang/PR19929.out: New file.
	* testsuite/libjava.lang/PR19929.java: New file.

Index: gcc/java/ChangeLog
from  Tom Tromey  <tromey@redhat.com>

	PR java/19921:
	* jcf-write.c (generate_bytecode_insns) <CALL_EXPR>: Note the
	stack effect of multianewarray.

Index: gcc/java/jcf-write.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/jcf-write.c,v
retrieving revision 1.161
diff -u -r1.161 jcf-write.c
--- gcc/java/jcf-write.c 1 Feb 2005 21:20:34 -0000 1.161
+++ gcc/java/jcf-write.c 13 Feb 2005 00:33:45 -0000
@@ -2572,6 +2572,7 @@
 	    OP1 (OPCODE_multianewarray);
 	    OP2 (index);
 	    OP1 (ndims);
+	    NOTE_POP (ndims - 1);
 	    break;
 	  }
 	else if (f == soft_anewarray_node)
Index: libjava/testsuite/libjava.lang/PR19929.java
===================================================================
RCS file: libjava/testsuite/libjava.lang/PR19929.java
diff -N libjava/testsuite/libjava.lang/PR19929.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ libjava/testsuite/libjava.lang/PR19929.java 13 Feb 2005 00:33:45 -0000
@@ -0,0 +1,11 @@
+interface I {
+    void f(Object x);
+}
+
+class PR19929 {
+    static void g(I i) {
+      // gcj used to create invalid bytecode for this.
+      i.f(new Object[1][1]);
+    }
+  public static void main(String[] args) { }
+}
Index: libjava/testsuite/libjava.lang/PR19929.out
===================================================================
RCS file: libjava/testsuite/libjava.lang/PR19929.out
diff -N libjava/testsuite/libjava.lang/PR19929.out


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