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]

[PATCH] Fix PR40248


This fixes expanding of VIEW_CONVERT_EXPRs.  It looks like we opened
a can of worms when expanding its operand in the target mode - most
expanders do not expect to be "garbage" here.  While I fixed one such
place with my earlier patch there are many more.

So IMHO the best is to expand the operand in its natural mode and
deal with it (as we have to, anyway).

Bootstrap and regtest running on x86_64-unknown-linux-gnu.

Comments?

Thanks,
Richard.

2009-05-26  Richard Guenther  <rguenther@suse.de>

	PR middle-end/40248
	Revert
	* expr.c (expand_expr_real_1): Avoid calling do_store_flag
	with mismatched comparison modes.

	* expr.c (expand_expr_real_1): Expand the operand of a
	VIEW_CONVERT_EXPR in its natural mode.

Index: gcc/expr.c
===================================================================
*** gcc/expr.c	(revision 147866)
--- gcc/expr.c	(working copy)
*************** expand_expr_real_1 (tree exp, rtx target
*** 8248,8254 ****
        }
  
        if (!op0)
! 	op0 = expand_expr (TREE_OPERAND (exp, 0), NULL_RTX, mode, modifier);
  
        /* If the input and output modes are both the same, we are done.  */
        if (mode == GET_MODE (op0))
--- 8248,8255 ----
        }
  
        if (!op0)
! 	op0 = expand_expr (TREE_OPERAND (exp, 0),
! 			   NULL_RTX, VOIDmode, modifier);
  
        /* If the input and output modes are both the same, we are done.  */
        if (mode == GET_MODE (op0))
*************** expand_expr_real_1 (tree exp, rtx target
*** 9042,9053 ****
      case LTGT_EXPR:
        temp = do_store_flag (exp,
  			    modifier != EXPAND_STACK_PARM ? target : NULL_RTX,
! 			    (tmode != VOIDmode
! 			     /* do_store_flag does not handle target modes
! 				of a different class than the comparison mode.
! 				Avoid ICEing in convert_move.  */
! 			     && GET_MODE_CLASS (tmode) == GET_MODE_CLASS (mode))
! 			    ? tmode : mode);
        if (temp != 0)
  	return temp;
  
--- 9043,9049 ----
      case LTGT_EXPR:
        temp = do_store_flag (exp,
  			    modifier != EXPAND_STACK_PARM ? target : NULL_RTX,
! 			    tmode != VOIDmode ? tmode : mode);
        if (temp != 0)
  	return temp;
  


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