[PATCH 1/4] sched-deps: clear dependency caches before freeing them

<[email protected]>
Newsgroups gmane.comp.gcc.patches
Message-ID <[email protected]>
From: Kyrylo Tkachov <[email protected]>

sched_deps_finish resets cache_size before it uses cache_size to clear the
dependency cache bitmaps.  The cleanup loop therefore has zero iterations.
The cache arrays are freed, but their bitmap elements are not returned to
the bitmap obstack.

Move the reset after the cleanup loop.

Bootstrapped and tested on aarch64-none-linux-gnu and x86_64-linux.

gcc/ChangeLog:

	* sched-deps.cc (sched_deps_finish): Reset cache_size after clearing
	and freeing the dependency caches.

Signed-off-by: Kyrylo Tkachov <[email protected]>
---
 gcc/sched-deps.cc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gcc/sched-deps.cc b/gcc/sched-deps.cc
index b2da11c7900..23f3545b54c 100644
--- a/gcc/sched-deps.cc
+++ b/gcc/sched-deps.cc
@@ -4171,7 +4171,6 @@ sched_deps_finish (void)
   dl_pool = NULL;
 
   h_d_i_d.release ();
-  cache_size = 0;
 
   if (true_dependency_cache)
     {
@@ -4203,6 +4202,8 @@ sched_deps_finish (void)
         }
 
     }
+
+  cache_size = 0;
 }
 
 /* Initialize some global variables needed by the dependency analysis
-- 
2.50.1 (Apple Git-155)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.