public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] middle-end/114604 - ranger allocates bitmap without initialized obstack
@ 2024-04-08  9:49 Richard Biener
  0 siblings, 0 replies; 14+ messages in thread
From: Richard Biener @ 2024-04-08  9:49 UTC (permalink / raw)
  To: gcc-patches; +Cc: Jakub Jelinek, amacleod

The following fixes ranger bitmap allocation when invoked from IPA
context where the global bitmap obstack possibly isn't initialized.
Instead of trying to use one of the ranger obstacks the following
simply initializes the global bitmap obstack around an active ranger.

Bootstrapped and tested on x86_64-unknown-linux-gnu with bitmap_alloc
instrumentation (all ICEs gone, so ranger was the only offender).

OK?

Thanks,
Richard.

	PR middle-end/114604
	* gimple-range.cc (enable_ranger): Initialize the global
	bitmap obstack.
	(disable_ranger): Release it.
---
 gcc/gimple-range.cc | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/gcc/gimple-range.cc b/gcc/gimple-range.cc
index c16b776c1e3..4d3b1ce8588 100644
--- a/gcc/gimple-range.cc
+++ b/gcc/gimple-range.cc
@@ -689,6 +689,8 @@ enable_ranger (struct function *fun, bool use_imm_uses)
 {
   gimple_ranger *r;
 
+  bitmap_obstack_initialize (NULL);
+
   gcc_checking_assert (!fun->x_range_query);
   r = new gimple_ranger (use_imm_uses);
   fun->x_range_query = r;
@@ -705,6 +707,8 @@ disable_ranger (struct function *fun)
   gcc_checking_assert (fun->x_range_query);
   delete fun->x_range_query;
   fun->x_range_query = NULL;
+
+  bitmap_obstack_release (NULL);
 }
 
 // ------------------------------------------------------------------------
-- 
2.35.3

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

end of thread, other threads:[~2024-06-26  8:50 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20240408095018.4853D385841E@sourceware.org>
2024-04-08 15:40 ` [PATCH] middle-end/114604 - ranger allocates bitmap without initialized obstack Aldy Hernandez
2024-04-08 15:54   ` Jakub Jelinek
2024-04-08 16:08     ` Aldy Hernandez
2024-04-08 16:28       ` Richard Biener
2024-04-08 16:39         ` Aldy Hernandez
2024-04-08 17:47           ` Richard Biener
2024-04-09  5:43             ` Aldy Hernandez
2024-04-09  6:48               ` Richard Biener
2024-06-20  8:08             ` Aldy Hernandez
2024-06-20  9:31               ` Richard Biener
2024-06-20 14:05                 ` Andrew MacLeod
2024-06-20 14:36                   ` Richard Biener
2024-06-26  8:50                     ` Aldy Hernandez
2024-04-08  9:49 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).