Patch: PR java/8712

Tom Tromey
Thu Dec 19 21:04:00 GMT 2002

This patch fixes PR java/8712.

Instead of generating an incorrect COND_EXPR (which causes an abort in
fold-const), we now generate a valid NE_EXPR.

Test on x86 Red Hat Linux 7.3.

Ok to commit?  I want to put it on the trunk and the 3.3 branch.


Index: ChangeLog
from  Tom Tromey  <>

	Fix for PR java/8712:
	* expr.c (build_instanceof): Build an NE_EXPR, not a COND_EXPR,
	when simply checking against `null'.

Index: expr.c
RCS file: /cvs/gcc/gcc/gcc/java/expr.c,v
retrieving revision 1.154
diff -u -r1.154 expr.c
--- expr.c 16 Dec 2002 18:22:32 -0000 1.154
+++ expr.c 20 Dec 2002 03:48:26 -0000
@@ -1257,9 +1257,7 @@
       /* Anything except `null' is an instance of Object.  Likewise,
 	 if the object is known to be an instance of the class, then
 	 we only need to check for `null'.  */
-      expr = build (COND_EXPR, itype,
-		    value,
-		    boolean_true_node, boolean_false_node);
+      expr = build (NE_EXPR, itype, value, null_pointer_node);
   else if (! TYPE_ARRAY_P (type)
 	   && ! TYPE_ARRAY_P (valtype)

More information about the Java-patches mailing list