[Bug middle-end/17412] [4.0 Regression] tree check failure in fold-const

steven at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Sat Sep 11 00:00:00 GMT 2004


------- Additional Comments From steven at gcc dot gnu dot org  2004-09-11 00:00 -------
IMO fold-const.c should never try to touch language specific trees 
like this.  So tentative fix: 
 
Index: tree.c 
=================================================================== 
RCS file: /cvs/gcc/gcc/gcc/tree.c,v 
retrieving revision 1.424 
diff -c -3 -p -r1.424 tree.c 
*** tree.c      9 Sep 2004 07:54:06 -0000       1.424 
--- tree.c      10 Sep 2004 23:57:30 -0000 
*************** type_contains_placeholder_p (tree type) 
*** 1797,1803 **** 
  } 
 
  /* Return 1 if EXP contains any expressions that produce cleanups for an 
!    outer scope to deal with.  Used by fold.  */ 
 
  int 
  has_cleanups (tree exp) 
--- 1797,1804 ---- 
  } 
 
  /* Return 1 if EXP contains any expressions that produce cleanups for an 
!    outer scope to deal with, -1 for language specific trees, and 0 for 
!    expressions that certainly don't need cleanups.  Used by fold.  */ 
 
  int 
  has_cleanups (tree exp) 
Index: fold-const.c 
=================================================================== 
RCS file: /cvs/gcc/gcc/gcc/fold-const.c,v 
retrieving revision 1.452 
diff -c -3 -p -r1.452 fold-const.c 
*** fold-const.c        8 Sep 2004 15:44:45 -0000       1.452 
--- fold-const.c        10 Sep 2004 23:57:30 -0000 
*************** fold (tree expr) 
*** 8906,8915 **** 
                                           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); 
 
        { 
--- 8906,8916 ---- 
                                           TREE_OPERAND (arg0, 1))))); 
        return t; 
 
      case CLEANUP_POINT_EXPR: 
!       /* Pull arithmetic ops out of the CLEANUP_POINT_EXPR where 
!          appropriate.  Do nothing for language specific trees, in 
!        which case has_cleanups returns <0.  */ 
!       if (has_cleanups (arg0) <= 0) 
        return TREE_OPERAND (t, 0); 
 
        { 

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17412



More information about the Gcc-bugs mailing list