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][4.1] Fix PR29610, ICE due to bug in cleanup_control_flow


This fixes PR29610 which manifests itself in dominators being not 
available even if cleanup_tree_cfg_loop ensures they get re-computed
on changes.  Unfortunately, cleanup_control_flow calls 
tree_purge_dead_eh_edges without honoring its return value which causes
the dominator freeing to be missed.

Bootstrapped and tested on x86_64-unknown-linux-gnu.

Ok for the 4.1 branch?  The problem is latent on 4.2 and the mainline, ok
there too?

Thanks,
Richard.

:ADDPATCH middle-end:

2006-11-01  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/29610
	* tree-cfgcleanup.c (cleanup_control_flow): Honor return value
	of tree_purge_dead_eh_edges as it may free dominators.

	* g++.dg/other/pr29610.C: New testcase.

Index: tree-cfgcleanup.c
===================================================================
*** tree-cfgcleanup.c	(revision 118379)
--- tree-cfgcleanup.c	(working copy)
*************** cleanup_control_flow (void)
*** 160,166 ****
  
        /* If the last statement of the block could throw and now cannot,
  	 we need to prune cfg.  */
!       tree_purge_dead_eh_edges (bb);
  
        if (bsi_end_p (bsi))
  	continue;
--- 160,166 ----
  
        /* If the last statement of the block could throw and now cannot,
  	 we need to prune cfg.  */
!       retval |= tree_purge_dead_eh_edges (bb);
  
        if (bsi_end_p (bsi))
  	continue;
/* { dg-do compile } */
/* { dg-options "-O2 -funswitch-loops" } */

struct __normal_iterator 
{
  typedef int*const *_Iterator;
  int*const * _M_current;
  __normal_iterator(const _Iterator& __i) : _M_current(__i){}
  const _Iterator& base() const {}
};
struct string { ~string(){} };
struct vector 
{
  int** _M_finish;
  __normal_iterator end() const   { return __normal_iterator (_M_finish); }
  int size() const   { return end().base() - end().base(); }
};
class Painter
{
  int redraw_window(void);
  typedef int (Painter::* SliceWindowFunc)(void);
  int for_each(vector&, SliceWindowFunc);
  void tcl_command(void);
};
inline int Painter::for_each(vector &layout, SliceWindowFunc func)
{
    for (unsigned int window = 0; window < layout.size();++window)
        (this->*func)();
}
int t;
int Painter::redraw_window(void) {t = 1;}
string t2(int);
vector *g(const string&);
void Painter::tcl_command(void)
{
     for_each(*g(t2(2)), &Painter::redraw_window);
}


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