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]

Re: [PATCH] Fix ICE in convert_move expanding V_C_E via store-flag


On Tue, 19 May 2009, Richard Guenther wrote:

> On Mon, 18 May 2009, Richard Guenther wrote:
> 
> > 
> > When expanding the V_C_E of the comparison result in the testcase below
> > we end up calling do_store_flag for an integer comparison with
> > SFmode target mode.  This isn't going to work and probably was never
> > intended to.  The following avoids the situation.
> > 
> > Bootstrapped and tested on x86_64-unknown-linux-gnu, ok?
> 
> Patch was missing a ChangeLog.

And this is what I checked in after bootstrapping and testing
on x86_64-unknown-linux-gnu.

Richard.

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

	* expr.c (expand_expr_real_1): Avoid calling do_store_flag
	with mismatched comparison modes.

	* gcc.c-torture/compile/20090518-1.c: New testcase.

Index: gcc/testsuite/gcc.c-torture/compile/20090518-1.c
===================================================================
*** gcc/testsuite/gcc.c-torture/compile/20090518-1.c	(revision 0)
--- gcc/testsuite/gcc.c-torture/compile/20090518-1.c	(revision 0)
***************
*** 0 ****
--- 1,6 ----
+ float
+ foo(int i)
+ {
+   int j = i == 42;
+   return *(float *)&j;
+ }
Index: gcc/expr.c
===================================================================
*** gcc/expr.c	(revision 147701)
--- gcc/expr.c	(working copy)
*************** expand_expr_real_1 (tree exp, rtx target
*** 9042,9048 ****
      case LTGT_EXPR:
        temp = do_store_flag (exp,
  			    modifier != EXPAND_STACK_PARM ? target : NULL_RTX,
! 			    tmode != VOIDmode ? tmode : mode);
        if (temp != 0)
  	return temp;
  
--- 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;
  


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