This is the mail archive of the 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/9157: ICE on malformed ?: condition


  This patch resolves PR java/9157. We were already
taking care of the fact that the "?" and the ":"
parts of a ?: operator could be artificially crafted
StringBuffers from expressions like "foo" + bar - we
need to also take care of this in the condition of
the ?: operator.

The first hunk removes a redundant "if (op2)" condition
that I happened to notice.

Tested on i686-pc-linux-gnu with Jacks included - produced
no new FAILs or XPASSes (:-().

OK for mainline?

BTW, how can I add a testcase for this PR - it used
to ICE before and should now fail with an error - there
is no "transition" w.r.t. to the failure status...


Ranjit Mathew      Email: rmathew AT gmail DOT com

Bangalore, INDIA.    Web:
Index: ChangeLog
from  Ranjit Mathew  <>

	PR java/9157
	* parse.y (build_string_concatenation): Remove redundant if.
	(patch_conditional_expr): Attempt to patch_string() the condition
	of a ?: as well, in addition to its other operands.

Index: parse.y
--- parse.y	2005-01-31 18:08:16.000000000 +0530
+++ parse.y	2005-01-31 19:16:49.000000000 +0530
@@ -14033,6 +14033,5 @@ build_string_concatenation (tree op1, tr
       IS_CRAFTED_STRING_BUFFER_P (op1) = 0;
       /* Create a node for `{new...,xxx}.append (op2)' */
-      if (op2)
-	op1 = make_qualified_primary (op1, BUILD_APPEND (op2), 0);
+      op1 = make_qualified_primary (op1, BUILD_APPEND (op2), 0);
@@ -16049,5 +16048,7 @@ patch_conditional_expr (tree node, tree 
   /* Operands of ?: might be StringBuffers crafted as a result of a
-     string concatenation. Obtain a descent operand here.  */
+     string concatenation.  Obtain a decent operand here.  */
+  if ((patched = patch_string (cond)))
+    TREE_OPERAND (node, 0) = cond = patched;
   if ((patched = patch_string (op1)))
     TREE_OPERAND (node, 1) = op1 = patched;

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