Patch: fix PR java/12915

Tom Tromey tromey@redhat.com
Tue Nov 11 20:05:00 GMT 2003


This patch fixes PR 12915, a java regression.

In merge_string_cste we can sometimes end up with an integer zero
that has a pointer type, instead of null_pointer_node.  This patch
adds a test for this condition.

Tested on x86 Red Hat Linux 9 (including Jacks).  Ok?

I'll check in a test case separately.

Tom

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

	PR java/12915:
	* parse.y (merge_string_cste): Handle case where we have a
	pointer that happens to be zero, not null_pointer_node.

Index: parse.y
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/parse.y,v
retrieving revision 1.451
diff -u -r1.451 parse.y
--- parse.y 22 Oct 2003 18:06:38 -0000 1.451
+++ parse.y 11 Nov 2003 19:51:58 -0000
@@ -13844,7 +13844,9 @@
 	string = boolean_true;
       else if (op2 == boolean_false_node)
 	string = boolean_false;
-      else if (op2 == null_pointer_node)
+      else if (op2 == null_pointer_node
+	       || (integer_zerop (op2)
+		   && TREE_CODE (TREE_TYPE (op2)) == POINTER_TYPE))
 	/* FIXME: null is not a compile-time constant, so it is only safe to
 	   merge if the overall expression is non-constant. However, this
 	   code always merges without checking the overall expression.  */



More information about the Java-patches mailing list