This is an automated email from Gerrit. "Antonio Borneo <borneo.anto...@gmail.com>" just uploaded a new patch set to Gerrit, which you can find at https://review.openocd.org/c/openocd/+/7380
-- gerrit commit 0a7fc1d03eb0640495e3b4975139f894389c96b9 Author: Antonio Borneo <borneo.anto...@gmail.com> Date: Wed Nov 16 23:06:12 2022 +0100 jtag: xds110: fix clang error core.StackAddressEscape Clang ignores that xds110_swd_write_reg() is always called with bit SWD_CMD_RNW in 'cmd' set to zero. It then complains that the local variable 'value' gets passed by address to xds110_swd_queue_cmd() and in case of 'read request' such stack address get stored for later use: src/jtag/drivers/xds110.c:1363:1: warning: Address of stack memory associated with local variable 'value' is still referred to by the global variable 'xds110' upon returning to the caller. This will be a dangling reference [core.StackAddressEscape] To both xds110_swd_write_reg() and xds110_swd_read_reg(), add an assert() to inform Clang about the state of bit SWD_CMD_RNW. Change-Id: I7687c055ec71424b642e152f478723a930966e3a Signed-off-by: Antonio Borneo <borneo.anto...@gmail.com> diff --git a/src/jtag/drivers/xds110.c b/src/jtag/drivers/xds110.c index ecba36bb9a..8e5d638db1 100644 --- a/src/jtag/drivers/xds110.c +++ b/src/jtag/drivers/xds110.c @@ -1354,11 +1354,13 @@ static void xds110_swd_queue_cmd(uint8_t cmd, uint32_t *value) static void xds110_swd_read_reg(uint8_t cmd, uint32_t *value, uint32_t ap_delay_clk) { + assert(cmd & SWD_CMD_RNW); xds110_swd_queue_cmd(cmd, value); } static void xds110_swd_write_reg(uint8_t cmd, uint32_t value, uint32_t ap_delay_clk) { + assert(!(cmd & SWD_CMD_RNW)); xds110_swd_queue_cmd(cmd, &value); } --