diff mbox series

[COMMITTED] tree-optimization/115208 - Delete gori_map during destruction of GORI.

Message ID 378c8d02-760f-4f67-8f9b-18da81622229@redhat.com
State New
Headers show
Series [COMMITTED] tree-optimization/115208 - Delete gori_map during destruction of GORI. | expand

Commit Message

Andrew MacLeod May 26, 2024, 1:46 a.m. UTC
When a GORI object is constructed, we construct both GORI and a gori_map.

During destruction, I neglected to destruct the associated gori_map.  
doh!  sorry.

Bootstraps on x86_64-pc-linux-gnu with no regressions.  And hopefully 
resolves everyone's issues.

Andrew
diff mbox series

Patch

From e98cf19c2be1ffaf65d625e1d8b927a42e77b009 Mon Sep 17 00:00:00 2001
From: Andrew MacLeod <amacleod@redhat.com>
Date: Sat, 25 May 2024 12:28:52 -0400
Subject: [PATCH 4/4] Delete gori_map during destruction of a GORI..

Forgot to free the gori_mpa object when a gori object is freed.

	PR tree-optimization/115208
	* value-query.cc (range_query::create_gori): Confirm gori_map is NULL.
	(range_query::destroy_gori): Free gori_map if one was allocated.
---
 gcc/value-query.cc | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/gcc/value-query.cc b/gcc/value-query.cc
index 0d0c0e8058e..556a0f39b09 100644
--- a/gcc/value-query.cc
+++ b/gcc/value-query.cc
@@ -188,6 +188,7 @@  void
 range_query::create_gori (int not_executable_flag, int sw_max_edges)
 {
   gcc_checking_assert (m_gori == &default_gori);
+  gcc_checking_assert (m_map == NULL);
   m_map = new gori_map ();
   gcc_checking_assert (m_map);
   m_gori = new gori_compute (*m_map, not_executable_flag, sw_max_edges);
@@ -199,6 +200,9 @@  range_query::destroy_gori ()
 {
   if (m_gori && m_gori != &default_gori)
     delete m_gori;
+  if (m_map)
+    delete m_map;
+  m_map = NULL;
   m_gori= &default_gori;
 }
 
-- 
2.41.0