]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
fix assert in __deregister_frame_info_bases
authorSören Tempel <soeren+git@soeren-tempel.net>
Sun, 14 May 2023 17:30:21 +0000 (19:30 +0200)
committerThomas Neumann <tneumann@users.sourceforge.net>
Mon, 15 May 2023 09:46:29 +0000 (11:46 +0200)
The assertion in __deregister_frame_info_bases assumes that for every
frame something was inserted into the lookup data structure by
__register_frame_info_bases. Unfortunately, this does not necessarily
hold true as the btree_insert call in __register_frame_info_bases will
not insert anything for empty ranges. Therefore, we need to explicitly
account for such empty ranges in the assertion as `ob` will be a null
pointer for such ranges, hence causing the assertion to fail.

Signed-off-by: Sören Tempel <soeren@soeren-tempel.net>
libgcc/ChangeLog:
* unwind-dw2-fde.c: Accept empty ranges when deregistering frames.

libgcc/unwind-dw2-fde.c

index 7b74c391ced1b70990736161a22c9adcea524a04..8683a65aa025a798888413802f16b203999a65a6 100644 (file)
@@ -278,7 +278,9 @@ __deregister_frame_info_bases (const void *begin)
   __gthread_mutex_unlock (&object_mutex);
 #endif
 
-  gcc_assert (in_shutdown || ob);
+  // If we didn't find anything in the lookup data structures then they
+  // were either already destroyed or we tried to remove an empty range.
+  gcc_assert (in_shutdown || ((range[1] - range[0]) == 0 || ob));
   return (void *) ob;
 }