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]

Re: error_marks in expand_expr


> Note that expand_expr already has some code to handle ERROR_MARK, way down
> in the main switch.

This function is way too large ... So you were thinking rather about
this patch?

Martin

Wed Mar 17 01:50:36 1999  Martin von L÷wis  <loewis@informatik.hu-berlin.de>

	* expr.c (expand_expr): Handle ERROR_MARK much earlier.

Index: expr.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/expr.c,v
retrieving revision 1.129
diff -c -p -r1.129 expr.c
*** expr.c	1999/03/12 00:02:32	1.129
--- expr.c	1999/03/17 00:37:56
*************** expand_expr (exp, target, tmode, modifie
*** 5471,5491 ****
    register rtx op0, op1, temp;
    tree type = TREE_TYPE (exp);
    int unsignedp = TREE_UNSIGNED (type);
!   register enum machine_mode mode = TYPE_MODE (type);
    register enum tree_code code = TREE_CODE (exp);
    optab this_optab;
!   /* Use subtarget as the target for operand 0 of a binary operation.  */
!   rtx subtarget = (target != 0 && GET_CODE (target) == REG ? target : 0);
!   rtx original_target = target;
!   int ignore = (target == const0_rtx
! 		|| ((code == NON_LVALUE_EXPR || code == NOP_EXPR
! 		     || code == CONVERT_EXPR || code == REFERENCE_EXPR
! 		     || code == COND_EXPR)
! 		    && TREE_CODE (type) == VOID_TYPE));
    tree context;
    /* Used by check-memory-usage to make modifier read only.  */
    enum expand_modifier ro_modifier;
  
    /* Make a read-only version of the modifier.  */
    if (modifier == EXPAND_NORMAL || modifier == EXPAND_SUM
        || modifier == EXPAND_CONST_ADDRESS || modifier == EXPAND_INITIALIZER)
--- 5471,5504 ----
    register rtx op0, op1, temp;
    tree type = TREE_TYPE (exp);
    int unsignedp = TREE_UNSIGNED (type);
!   register enum machine_mode mode;
    register enum tree_code code = TREE_CODE (exp);
    optab this_optab;
!   rtx subtarget, original_target;
!   int ignore;
    tree context;
    /* Used by check-memory-usage to make modifier read only.  */
    enum expand_modifier ro_modifier;
  
+   /* Handle ERROR_MARK before anybody tries to access its type. */
+   if (TREE_CODE (exp) == ERROR_MARK)
+     {
+       op0 = CONST0_RTX (tmode);
+       if (op0 != 0)
+ 	return op0;
+       return const0_rtx;
+     }
+ 
+   mode = TYPE_MODE (type);
+   /* Use subtarget as the target for operand 0 of a binary operation.  */
+   subtarget = (target != 0 && GET_CODE (target) == REG ? target : 0);
+   original_target = target;
+   ignore = (target == const0_rtx
+ 	    || ((code == NON_LVALUE_EXPR || code == NOP_EXPR
+ 		 || code == CONVERT_EXPR || code == REFERENCE_EXPR
+ 		 || code == COND_EXPR)
+ 		&& TREE_CODE (type) == VOID_TYPE));
+ 
    /* Make a read-only version of the modifier.  */
    if (modifier == EXPAND_NORMAL || modifier == EXPAND_SUM
        || modifier == EXPAND_CONST_ADDRESS || modifier == EXPAND_INITIALIZER)
*************** expand_expr (exp, target, tmode, modifie
*** 8143,8154 ****
  	emit_move_insn (dhc, validize_mem (gen_rtx_MEM (Pmode, dhc)));
  	return const0_rtx;
        }
- 
-     case ERROR_MARK:
-       op0 = CONST0_RTX (tmode);
-       if (op0 != 0)
- 	return op0;
-       return const0_rtx;
  
      default:
        return (*lang_expand_expr) (exp, original_target, tmode, modifier);
--- 8156,8161 ----



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