]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
middle-end/114604 - ranger allocates bitmap without initialized obstack
authorRichard Biener <rguenther@suse.de>
Mon, 8 Apr 2024 08:50:18 +0000 (10:50 +0200)
committerRichard Biener <rguenther@suse.de>
Tue, 9 Apr 2024 06:46:21 +0000 (08:46 +0200)
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.

PR middle-end/114604
* gimple-range.cc (enable_ranger): Initialize the global
bitmap obstack.
(disable_ranger): Release it.

gcc/gimple-range.cc

index c16b776c1e3a2c6c2758a790aded1161c9394bf5..4d3b1ce8588470751d2e4fae7d7a847f2d75b098 100644 (file)
@@ -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);
 }
 
 // ------------------------------------------------------------------------