From cca6755d2867e5687a3cba8de2319295fe9f8860 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Thu, 1 Aug 2024 11:11:27 +0300 Subject: [PATCH] thirdparty: patch thirdparty/libgc/gc.c to make `-cc gcc-11 -cstrict` pass in more cases --- thirdparty/libgc/gc.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/thirdparty/libgc/gc.c b/thirdparty/libgc/gc.c index d43f09ddb6..f8e44bc10b 100644 --- a/thirdparty/libgc/gc.c +++ b/thirdparty/libgc/gc.c @@ -35507,6 +35507,7 @@ STATIC void GC_suspend_handler_inner(ptr_t dummy, void *context) GC_log_printf("Suspending %p\n", (void *)pthread_self()); # endif me = GC_lookup_self_thread_async(); + if (NULL == me) return NULL; // __v_, make the sanitizers and -cstrict happy if ((me -> last_stop_count & ~(word)THREAD_RESTARTED) == my_stop_count) { /* Duplicate signal. OK if we are retrying. */ if (!GC_retry_signals) { @@ -37527,7 +37528,10 @@ STATIC GC_thread GC_self_thread(void) { GC_INNER void GC_reset_finalizer_nested(void) { GC_ASSERT(I_HOLD_LOCK()); - GC_self_thread_inner() -> crtn -> finalizer_nested = 0; + GC_thread me; + me = GC_self_thread_inner(); + if (NULL == me) return; // __v_, make the sanitizers and -cstrict happy + me -> crtn -> finalizer_nested = 0; } /* Checks and updates the thread-local level of finalizers recursion. */ @@ -37549,6 +37553,7 @@ STATIC GC_thread GC_self_thread(void) { /* to be called before the thread gets registered. */ if (EXPECT(NULL == me, FALSE)) return NULL; # endif + if (NULL == me) return NULL; // __v_, make the sanitizers and -cstrict happy crtn = me -> crtn; nesting_level = crtn -> finalizer_nested; if (nesting_level) {