]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Add default bitmap obstack allocation check
authorRichard Biener <rguenther@suse.de>
Fri, 5 Apr 2024 09:02:46 +0000 (11:02 +0200)
committerRichard Biener <rguenther@suse.de>
Fri, 3 May 2024 11:26:27 +0000 (13:26 +0200)
The following adds a check that the global bitmap obstack is initialized
when allocating a bitmap from it.

* bitmap.cc (bitmap_alloc): When using the global bitmap obstack
assert that is initialized.

gcc/bitmap.cc

index 459e32c1ad18502e700e789076ba257cd61b1974..0905cde696fd90d80b1bfe0100167fb2b2e5f21f 100644 (file)
@@ -781,7 +781,10 @@ bitmap_alloc (bitmap_obstack *bit_obstack MEM_STAT_DECL)
   bitmap map;
 
   if (!bit_obstack)
-    bit_obstack = &bitmap_default_obstack;
+    {
+      gcc_assert (bitmap_default_obstack_depth > 0);
+      bit_obstack = &bitmap_default_obstack;
+    }
   map = bit_obstack->heads;
   if (map)
     bit_obstack->heads = (class bitmap_head *) map->first;