Skip to content

Conversation

@aescolar
Copy link
Member

@aescolar aescolar commented Apr 4, 2025

gcc 11.4.0, seems to believe this variable may be used uninitialized, and warns about it
(causing a test build failure due to warnings being treated as errors).
Let's just initialize the variable to 0 to avoid the issue, as the cost is trivial.

subsys/bluetooth/host/classic/hfp_ag.c: In function
  ‘bt_hfp_ag_vts_handler’:
1095
subsys/bluetooth/host/classic/hfp_ag.c:3091:17: error: ‘code’ may be
  used uninitialized in this function [-Werror=maybe-uninitialized]
1096
 3091 |                 bt_ag->transmit_dtmf_code(ag, code);
1097
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1098

The issue can be reproduced for ex. with:
$ mkdir build ; cd build
$ cmake -GNinja -DBOARD=native_sim/native/64 ../tests/bluetooth/shell \
 -DCONF_FILE="prj_br.conf"
$ ninja

Can be seen failing in CI here:
https://github.com/zephyrproject-rtos/zephyr/actions/runs/14261603624/job/39974559922?pr=87987#step:12:1096

Issue seems to have been introduced in #77694

@github-actions github-actions bot added size: XS A PR changing only a single line of code area: Bluetooth area: Bluetooth Classic Bluetooth Classic (BR/EDR) labels Apr 4, 2025
gcc 11.4.0, seems to believe this variable may be used uninitialized,
and warns about it (causing a test build failure due to warnings
being treated as errors).
Let's just initialize the variable to 0 to avoid the issue, as the
cost is trivial.

subsys/bluetooth/host/classic/hfp_ag.c: In function
  ‘bt_hfp_ag_vts_handler’:
1095
subsys/bluetooth/host/classic/hfp_ag.c:3091:17: error: ‘code’ may be
  used uninitialized in this function [-Werror=maybe-uninitialized]
1096
 3091 |                 bt_ag->transmit_dtmf_code(ag, code);
1097
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1098

The issue can be reproduced for ex. with:
$ mkdir build ; cd build
$ cmake -GNinja -DBOARD=native_sim/native/64 ../tests/bluetooth/shell \
 -DCONF_FILE="prj_br.conf"
$ ninja

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
@aescolar aescolar added Hotfix Fix for issues blocking development, i.e. upstream CI issues, tests failing in upstream CI , etc. Trivial Changes that can be reviewed by anyone, i.e. doc changes, minor build system tweaks, etc. labels Apr 4, 2025
@kartben kartben merged commit 59b6224 into zephyrproject-rtos:main Apr 4, 2025
39 checks passed
@aescolar aescolar deleted the hfp_ag_init branch April 5, 2025 06:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: Bluetooth Classic Bluetooth Classic (BR/EDR) area: Bluetooth Hotfix Fix for issues blocking development, i.e. upstream CI issues, tests failing in upstream CI , etc. size: XS A PR changing only a single line of code Trivial Changes that can be reviewed by anyone, i.e. doc changes, minor build system tweaks, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants