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: FYI: PR20056 thinko fix


I'm checking this in.

My PR 20056 patch had a dumb thinko in it, which further testing
(jonas) caught.  Whoops!  This patch fixes the bug.  It also adds a
test case, the OP pointed out on irc that it was easy to write one in
pure java (his came from a non-java language, I believe).

I ran this through all the previous tests plus jonas.

Tom

Index: gcc/java/ChangeLog
from  Tom Tromey  <tromey@redhat.com>
	PR java/20056:
	* verify-impl.c (types_equal): Fixed test.

Index: libjava/ChangeLog
from  Tom Tromey  <tromey@redhat.com>
	PR java/20056:
	* verify.cc (type::equals): Fixed test.
	* testsuite/libjava.lang/PR20056.out: New file.
	* testsuite/libjava.lang/PR20056.java: New file.

Index: libjava/verify.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/verify.cc,v
retrieving revision 1.66
diff -u -r1.66 verify.cc
--- libjava/verify.cc 19 Feb 2005 01:16:28 -0000 1.66
+++ libjava/verify.cc 19 Feb 2005 02:44:45 -0000
@@ -754,10 +754,10 @@
     bool equals (const type &other, _Jv_BytecodeVerifier *vfy)
     {
       // Only works for reference types.
-      if (key != reference_type
-	  || key != uninitialized_reference_type
-	  || other.key != reference_type
-	  || other.key != uninitialized_reference_type)
+      if ((key != reference_type
+	   && key != uninitialized_reference_type)
+	  || (other.key != reference_type
+	      && other.key != uninitialized_reference_type))
 	return false;
       // Only for single-valued types.
       if (klass->ref_next || other.klass->ref_next)
Index: libjava/testsuite/libjava.lang/PR20056.java
===================================================================
RCS file: libjava/testsuite/libjava.lang/PR20056.java
diff -N libjava/testsuite/libjava.lang/PR20056.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ libjava/testsuite/libjava.lang/PR20056.java 19 Feb 2005 02:44:45 -0000
@@ -0,0 +1,13 @@
+public class PR20056 {
+  int x;
+  PR20056(int x) {}
+  PR20056(PR20056 f) {
+    // The verifier rejected the generated code in this case.
+    this(f.x = 0);
+  }
+
+  public static void main(String[] args)
+  {
+    System.out.println("maude");
+  }
+}
Index: libjava/testsuite/libjava.lang/PR20056.out
===================================================================
RCS file: libjava/testsuite/libjava.lang/PR20056.out
diff -N libjava/testsuite/libjava.lang/PR20056.out
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ libjava/testsuite/libjava.lang/PR20056.out 19 Feb 2005 02:44:45 -0000
@@ -0,0 +1 @@
+maude
Index: gcc/java/verify-impl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/verify-impl.c,v
retrieving revision 1.5
diff -u -r1.5 verify-impl.c
--- gcc/java/verify-impl.c 19 Feb 2005 01:14:17 -0000 1.5
+++ gcc/java/verify-impl.c 19 Feb 2005 02:46:10 -0000
@@ -743,8 +743,9 @@
 static bool
 types_equal (type *t1, type *t2)
 {
-  if (t1->key != reference_type || t1->key != uninitialized_reference_type
-      || t2->key != reference_type || t2->key != uninitialized_reference_type)
+  if ((t1->key != reference_type && t1->key != uninitialized_reference_type)
+      || (t2->key != reference_type
+	  && t2->key != uninitialized_reference_type))
     return false;
   /* Only single-ref types are allowed.  */
   if (t1->klass->ref_next || t2->klass->ref_next)


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