fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bsc/+/28518 )
Change subject: lchan_select: fix 'chan_alloc_reverse' may be used uninitialized ......................................................................
lchan_select: fix 'chan_alloc_reverse' may be used uninitialized
GCC 12.1.0 emits -Wmaybe-uninitialized when building with '-O2'.
In function 'populate_ts_list', inlined from 'lchan_avail_by_type' at src/osmo-bsc/lchan_select.c:356:2: src/osmo-bsc/lchan_select.c:248:12: warning: 'chan_alloc_reverse' may be used uninitialized [-Wmaybe-uninitialized] 248 | if (chan_alloc_reverse) { | ^ src/osmo-bsc/lchan_select.c: In function 'lchan_avail_by_type': src/osmo-bsc/lchan_select.c:326:14: note: 'chan_alloc_reverse' was declared here 326 | bool chan_alloc_reverse; | ^~~~~~~~~~~~~~~~~~
This could only happen if in 'enum lchan_select_reason' we had items that are not handled in lchan_avail_by_type(), but this is not the case. Make GCC happy by initializing chan_alloc_reverse to false.
Change-Id: I3956621a6ec14ca5ff0ba0b11d2c956e2538efd8 --- M src/osmo-bsc/lchan_select.c 1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/18/28518/1
diff --git a/src/osmo-bsc/lchan_select.c b/src/osmo-bsc/lchan_select.c index ebc7ede..0ccdb6a 100644 --- a/src/osmo-bsc/lchan_select.c +++ b/src/osmo-bsc/lchan_select.c @@ -323,7 +323,7 @@ enum gsm_phys_chan_config first, first_cbch, second, second_cbch; struct lchan_select_ts_list ts_list; bool sort_by_trx_power = false; - bool chan_alloc_reverse; + bool chan_alloc_reverse = false;
if (log) { LOG_BTS(bts, DRLL, LOGL_DEBUG, "lchan_avail_by_type(type=%s, reason=%s)\n",