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] PR c++/17412 (ICE building Qt)


On Saturday 11 September 2004 17:40, Roger Sayle wrote:
> I'll preapprove the obvious patch that moves/duplicates the "arg00"
> assignment into the conditionals.

Like so.

Gr.
Steven

Index: fold-const.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fold-const.c,v
retrieving revision 1.454
diff -c -3 -p -r1.454 fold-const.c
*** fold-const.c	11 Sep 2004 03:21:13 -0000	1.454
--- fold-const.c	11 Sep 2004 19:43:27 -0000
*************** fold (tree expr)
*** 8946,8974 ****
  					   TREE_OPERAND (arg0, 1)))));
        return t;
  
        /* Pull arithmetic ops out of the CLEANUP_POINT_EXPR where
           appropriate.  */
-     case CLEANUP_POINT_EXPR:
        if (! has_cleanups (arg0))
  	return TREE_OPERAND (t, 0);
  
        {
  	enum tree_code code0 = TREE_CODE (arg0);
  	int kind0 = TREE_CODE_CLASS (code0);
- 	tree arg00 = TREE_OPERAND (arg0, 0);
- 	tree arg01;
  
  	if (kind0 == '1' || code0 == TRUTH_NOT_EXPR)
! 	  return fold (build1 (code0, type,
! 			       fold (build1 (CLEANUP_POINT_EXPR,
! 					     TREE_TYPE (arg00), arg00))));
  
  	if (kind0 == '<' || kind0 == '2'
  	    || code0 == TRUTH_ANDIF_EXPR || code0 == TRUTH_ORIF_EXPR
  	    || code0 == TRUTH_AND_EXPR   || code0 == TRUTH_OR_EXPR
  	    || code0 == TRUTH_XOR_EXPR)
  	  {
! 	    arg01 = TREE_OPERAND (arg0, 1);
  
  	    if (TREE_CONSTANT (arg00)
  		|| ((code0 == TRUTH_ANDIF_EXPR || code0 == TRUTH_ORIF_EXPR)
--- 8946,8976 ----
  					   TREE_OPERAND (arg0, 1)))));
        return t;
  
+     case CLEANUP_POINT_EXPR:
        /* Pull arithmetic ops out of the CLEANUP_POINT_EXPR where
           appropriate.  */
        if (! has_cleanups (arg0))
  	return TREE_OPERAND (t, 0);
  
        {
  	enum tree_code code0 = TREE_CODE (arg0);
  	int kind0 = TREE_CODE_CLASS (code0);
  
  	if (kind0 == '1' || code0 == TRUTH_NOT_EXPR)
! 	  {
! 	    tree arg00 = TREE_OPERAND (arg0, 0);
! 	    return fold (build1 (code0, type,
! 				 fold (build1 (CLEANUP_POINT_EXPR,
! 					       TREE_TYPE (arg00), arg00))));
! 	  }
  
  	if (kind0 == '<' || kind0 == '2'
  	    || code0 == TRUTH_ANDIF_EXPR || code0 == TRUTH_ORIF_EXPR
  	    || code0 == TRUTH_AND_EXPR   || code0 == TRUTH_OR_EXPR
  	    || code0 == TRUTH_XOR_EXPR)
  	  {
! 	    tree arg00 = TREE_OPERAND (arg0, 0);
! 	    tree arg01 = TREE_OPERAND (arg0, 1);
  
  	    if (TREE_CONSTANT (arg00)
  		|| ((code0 == TRUTH_ANDIF_EXPR || code0 == TRUTH_ORIF_EXPR)
Index: testsuite/g++.dg/parse/break-in-for.C
===================================================================
RCS file: testsuite/g++.dg/parse/break-in-for.C
diff -N testsuite/g++.dg/parse/break-in-for.C
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- testsuite/g++.dg/parse/break-in-for.C	11 Sep 2004 19:43:27 -0000
***************
*** 0 ****
--- 1,11 ----
+ /* PR17412
+    fold-const would try to fold the operands of the break statement.  */
+ /* { dg-do compile } */
+  
+ 
+ void foo ()
+ {
+   for (;;)
+     for (;;({break;}));
+ }
+ 


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