public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix PR66794
@ 2015-07-08 11:46 Richard Biener
  2015-07-08 14:53 ` H.J. Lu
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Biener @ 2015-07-08 11:46 UTC (permalink / raw)
  To: gcc-patches


Passes do not expect post-dominators being around and thus forget
to invalidate them properly.  Thus passes computing them have to
free them.  The patch fixes path-isolation and adds an assert so
this doesn't happen again.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk.

Richard.

2015-07-08  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/66794
	* passes.c (execute_function_todo): Assert that post-dominators
	are not computed.
	* gimple-ssa-isolate-paths.c (gimple_ssa_isolate_erroneous_paths):
	Free post-dominators.

	* gcc.dg/torture/pr66794.c: New testcase.

Index: gcc/passes.c
===================================================================
--- gcc/passes.c	(revision 225534)
+++ gcc/passes.c	(working copy)
@@ -1929,6 +1929,7 @@ execute_function_todo (function *fn, voi
   if (flags & TODO_rebuild_cgraph_edges)
     cgraph_edge::rebuild_edges ();
 
+  gcc_assert (dom_info_state (fn, CDI_POST_DOMINATORS) == DOM_NONE);
   /* If we've seen errors do not bother running any verifiers.  */
   if (!seen_error ())
     {
Index: gcc/gimple-ssa-isolate-paths.c
===================================================================
--- gcc/gimple-ssa-isolate-paths.c	(revision 225534)
+++ gcc/gimple-ssa-isolate-paths.c	(working copy)
@@ -488,10 +488,10 @@ gimple_ssa_isolate_erroneous_paths (void
   /* We scramble the CFG and loop structures a bit, clean up
      appropriately.  We really should incrementally update the
      loop structures, in theory it shouldn't be that hard.  */
+  free_dominance_info (CDI_POST_DOMINATORS);
   if (cfg_altered)
     {
       free_dominance_info (CDI_DOMINATORS);
-      free_dominance_info (CDI_POST_DOMINATORS);
       loops_state_set (LOOPS_NEED_FIXUP);
       return TODO_cleanup_cfg | TODO_update_ssa;
     }
Index: gcc/testsuite/gcc.dg/torture/pr66794.c
===================================================================
--- gcc/testsuite/gcc.dg/torture/pr66794.c	(revision 0)
+++ gcc/testsuite/gcc.dg/torture/pr66794.c	(working copy)
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-w" } */
+
+int a, *b, e;
+static int **c = &b;
+
+struct
+{
+  int f0;
+} d;
+
+int *
+fn1 ()
+{
+  int f, **g = &b;
+  e = a;
+  for (; a;)
+    for (; d.f0; d.f0++)
+      ;
+  *g = &f;
+  return *c;
+}

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fix PR66794
  2015-07-08 11:46 [PATCH] Fix PR66794 Richard Biener
@ 2015-07-08 14:53 ` H.J. Lu
  2015-07-09  7:46   ` Richard Biener
  0 siblings, 1 reply; 3+ messages in thread
From: H.J. Lu @ 2015-07-08 14:53 UTC (permalink / raw)
  To: Richard Biener; +Cc: GCC Patches

On Wed, Jul 8, 2015 at 4:46 AM, Richard Biener <rguenther@suse.de> wrote:
>
> Passes do not expect post-dominators being around and thus forget
> to invalidate them properly.  Thus passes computing them have to
> free them.  The patch fixes path-isolation and adds an assert so
> this doesn't happen again.
>
> Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk.
>
> Richard.
>
> 2015-07-08  Richard Biener  <rguenther@suse.de>
>
>         PR tree-optimization/66794
>         * passes.c (execute_function_todo): Assert that post-dominators
>         are not computed.
>         * gimple-ssa-isolate-paths.c (gimple_ssa_isolate_erroneous_paths):
>         Free post-dominators.
>

This caused:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66807

-- 
H.J.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fix PR66794
  2015-07-08 14:53 ` H.J. Lu
@ 2015-07-09  7:46   ` Richard Biener
  0 siblings, 0 replies; 3+ messages in thread
From: Richard Biener @ 2015-07-09  7:46 UTC (permalink / raw)
  To: H.J. Lu; +Cc: GCC Patches

On Wed, 8 Jul 2015, H.J. Lu wrote:

> On Wed, Jul 8, 2015 at 4:46 AM, Richard Biener <rguenther@suse.de> wrote:
> >
> > Passes do not expect post-dominators being around and thus forget
> > to invalidate them properly.  Thus passes computing them have to
> > free them.  The patch fixes path-isolation and adds an assert so
> > this doesn't happen again.
> >
> > Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk.
> >
> > Richard.
> >
> > 2015-07-08  Richard Biener  <rguenther@suse.de>
> >
> >         PR tree-optimization/66794
> >         * passes.c (execute_function_todo): Assert that post-dominators
> >         are not computed.
> >         * gimple-ssa-isolate-paths.c (gimple_ssa_isolate_erroneous_paths):
> >         Free post-dominators.
> >
> 
> This caused:
> 
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66807

Fixes as obvious with

2015-07-09  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/66807
	* tree-chkp-opt.c (chkp_opt_fini): Free post dominator info.

Index: gcc/tree-chkp-opt.c
===================================================================
--- gcc/tree-chkp-opt.c	(revision 225546)
+++ gcc/tree-chkp-opt.c	(working copy)
@@ -1282,6 +1282,8 @@ static void
 chkp_opt_fini (void)
 {
   chkp_fix_cfg ();
+
+  free_dominance_info (CDI_POST_DOMINATORS);
 }
 
 /* Checker optimization pass function.  */

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-07-09  7:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-08 11:46 [PATCH] Fix PR66794 Richard Biener
2015-07-08 14:53 ` H.J. Lu
2015-07-09  7:46   ` Richard Biener

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).