File 1472-erts-Over-allocate-in-lcnt-to-silence-gcc-warning.patch of Package erlang
From daa57da6018b50bcf696bab34638b7fe81e3f1fa Mon Sep 17 00:00:00 2001
From: Lukas Larsson <lukas@erlang.org>
Date: Thu, 26 Oct 2023 12:27:42 +0200
Subject: [PATCH 2/6] erts: Over-allocate in lcnt to silence gcc warning
---
erts/emulator/beam/erl_thr_progress.c | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/erts/emulator/beam/erl_thr_progress.c b/erts/emulator/beam/erl_thr_progress.c
index ccd0b3aea1..84204b804c 100644
--- a/erts/emulator/beam/erl_thr_progress.c
+++ b/erts/emulator/beam/erl_thr_progress.c
@@ -320,20 +320,19 @@ tmp_thr_prgr_data(ErtsSchedulerData *esdp)
ErtsThrPrgrData *tpd = perhaps_thr_prgr_data(esdp);
if (!tpd) {
- /*
- * We only allocate the part up to the wakeup_request field which is
- * the first field only used by registered threads
- */
- size_t alloc_size = offsetof(ErtsThrPrgrData, wakeup_request);
+#ifdef ERTS_ENABLE_LOCK_COUNT
/* We may land here as a result of unmanaged_delay being called from
* the lock counting module, which in turn might be called from within
* the allocator, so we use plain malloc to avoid deadlocks. */
- tpd =
-#ifdef ERTS_ENABLE_LOCK_COUNT
- malloc(alloc_size);
+ tpd = malloc(sizeof(ErtsThrPrgrData));
#else
- erts_alloc(ERTS_ALC_T_T_THR_PRGR_DATA, alloc_size);
+ /*
+ * We only allocate the part up to the wakeup_request field which is
+ * the first field only used by registered threads
+ */
+ size_t alloc_size = offsetof(ErtsThrPrgrData, wakeup_request);
+ tpd = erts_alloc(ERTS_ALC_T_T_THR_PRGR_DATA, alloc_size);
#endif
init_tmp_thr_prgr_data(tpd);
--
2.35.3