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/+/7681

-- gerrit

commit 986c0be76e5b5e54800ca3404eaf0d541e7958bc
Author: Antonio Borneo <borneo.anto...@gmail.com>
Date:   Mon May 8 10:45:25 2023 +0200

    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.anto...@gmail.com>

diff --git a/src/target/xtensa/xtensa.c b/src/target/xtensa/xtensa.c
index 63ffefce70..5880637f41 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");

-- 

Reply via email to