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]

PR java/27025: ICE on simple initializer


gcj assumes that in the operation (A + B), where A and B are
constants, the result must be a constant.  It ain't necessaarily so.

Andrew.


2006-04-04  Andrew Haley  <aph@redhat.com>

	PR java/27025
	* parse.y (fold_constant_for_init): Make sure the result of
	folding a binop really is a constant.

Index: java/parse.y
===================================================================
--- java/parse.y	(revision 112663)
+++ java/parse.y	(working copy)
@@ -16295,7 +16295,10 @@
       if (val == NULL_TREE || ! TREE_CONSTANT (val))
 	return NULL_TREE;
       TREE_OPERAND (node, 1) = val;
-      return patch_binop (node, op0, op1, 1);
+      val = patch_binop (node, op0, op1, 1);
+      if (! TREE_CONSTANT (val))
+	return NULL_TREE;
+      return val;
 
     case UNARY_PLUS_EXPR:
     case NEGATE_EXPR:


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