diff options
author | Antonio Borneo <borneo.antonio@gmail.com> | 2023-05-08 10:45:25 +0200 |
---|---|---|
committer | Antonio Borneo <borneo.antonio@gmail.com> | 2023-05-13 08:47:27 +0000 |
commit | 160288137aad7dc8825566f2221dd24db7f81110 (patch) | |
tree | baadabda37001874133c41b31f85cba22bf2f9ff /src/target | |
parent | 329b10754aa2294d11717c461f356c174eba5094 (diff) | |
download | riscv-openocd-160288137aad7dc8825566f2221dd24db7f81110.zip riscv-openocd-160288137aad7dc8825566f2221dd24db7f81110.tar.gz riscv-openocd-160288137aad7dc8825566f2221dd24db7f81110.tar.bz2 |
xtensa: fix build with gcc 13.1.1
New gcc does not understand that the variable 'restore_ms' is set
to 'true' only when the variable 'ms' is assigned in
static int xtensa_write_dirty_registers(...)
{
xtensa_reg_val_t ms;
bool restore_ms = false;
...
if (...) {
ms = regval;
restore_ms = true;
...
}
...
if (restore_ms) {
USE(ms);
}
...
}
and complains about possible use of uninitialized variable 'ms'.
Sadly initialize 'ms' to zero to hide this false positive.
Change-Id: I1fb3949070c8abbf4aa45a740f0ca2fdb753d4fa
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7681
Reviewed-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Reviewed-by: Ian Thompson <ianst@cadence.com>
Tested-by: jenkins
Diffstat (limited to 'src/target')
-rw-r--r-- | src/target/xtensa/xtensa.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/target/xtensa/xtensa.c b/src/target/xtensa/xtensa.c index 63ffefc..5880637 100644 --- a/src/target/xtensa/xtensa.c +++ b/src/target/xtensa/xtensa.c @@ -607,7 +607,7 @@ static int xtensa_write_dirty_registers(struct target *target) xtensa_reg_val_t a3 = 0, woe; unsigned int ms_idx = (xtensa->core_config->core_type == XT_NX) ? xtensa->nx_reg_idx[XT_NX_REG_IDX_MS] : reg_list_size; - xtensa_reg_val_t ms; + xtensa_reg_val_t ms = 0; bool restore_ms = false; LOG_TARGET_DEBUG(target, "start"); |