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
This commit is contained in:
Antonio Borneo 2023-05-08 10:45:25 +02:00
parent 329b10754a
commit 160288137a
1 changed files with 1 additions and 1 deletions

View File

@ -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");