File 2591-Silence-spurious-compiler-warning.patch of Package erlang
From 8ac8af9f82701913f04eb280f7905d7a5ca82fd2 Mon Sep 17 00:00:00 2001
From: Robin Morisset <rmorisset@meta.com>
Date: Mon, 17 Mar 2025 06:25:31 -0700
Subject: [PATCH 11/15] Silence (spurious) compiler warning
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The code was structured as follows:
```
if (is_normal_sched) {
..
} else {
..
qbit = ..
}
..
if (!is_normal_sched)
clear_proc_dirty_queue_bit(p, rq, qbit);
```
and it resulted in an error deep in clear_proc_dirty_queue_bit (probably
because of some inlining): "error: ‘qbit’ may be used uninitialized in this
function [-Werror=maybe-uninitialized]"
This issue was previously hidden because of the control flow leading to
this part of the code being a bit different, but that changed with the
commit to "directly execute stolen processes", revealing this limitation
of the compiler warning.
This commit fixes it, simply by pushing the initialization of qbit
outside of the "if (is_normal_sched)" condition.
---
erts/emulator/beam/erl_process.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/erts/emulator/beam/erl_process.c b/erts/emulator/beam/erl_process.c
index 8bc98e6af5..75d1b6cdbd 100644
--- a/erts/emulator/beam/erl_process.c
+++ b/erts/emulator/beam/erl_process.c
@@ -10057,8 +10057,8 @@ execute_process:
}
else {
psflg_band_mask = ~((erts_aint32_t) 0);
- qbit = ((erts_aint32_t) 1) << ERTS_PSFLGS_GET_PRQ_PRIO(state);
}
+ qbit = ((erts_aint32_t) 1) << ERTS_PSFLGS_GET_PRQ_PRIO(state);
if (!(state & ERTS_PSFLG_PROXY))
psflg_band_mask &= ~ERTS_PSFLG_IN_RUNQ;
--
2.43.0