[c++, ICE, patch] Patch to add an error check in cp_build_unary_op

Steve Ellcey sje@cup.hp.com
Fri Jan 9 00:09:00 GMT 2009


A recent change/addition to the g++.dg/cpp0x/initlist12.C test caused an
ICE on IA64 in it's target specific invalid_unary_op function because
that function could not handle an ERROR_MARK.  Rather then fix it in the
IA64 target function I would like to check for ERROR_MARK before calling
the target function.  That way we don't need to handle it seperately in
each target specific function.  This is what is already being done in
c-typeck.c (build_unary_op) and I basically just duplicated that code.

This may be simple enough to be considered obvious but I thought I would
see if there are any objections.

Tested on IA64 HP-UX with no regressions.

OK for checkin?

Steve Ellcey
sje@cup.hp.com



2009-01-08  Steve Ellcey  <sje@cup.hp.com>

	* typeck.c (cp_build_unary_op): Check for ERROR_MARK.


Index: typeck.c
===================================================================
--- typeck.c	(revision 143178)
+++ typeck.c	(working copy)
@@ -4192,6 +4192,9 @@ cp_build_unary_op (enum tree_code code, 
   if (arg == error_mark_node)
     return error_mark_node;
 
+  if (TREE_CODE (TREE_TYPE (arg)) == ERROR_MARK)
+    return error_mark_node;
+
   if ((invalid_op_diag
        = targetm.invalid_unary_op ((code == UNARY_PLUS_EXPR
 				    ? CONVERT_EXPR



More information about the Gcc-patches mailing list