This is an automated email from Gerrit.

"Yang sheng <iyysh...@gmail.com>" just uploaded a new patch set to Gerrit, 
which you can find at https://review.openocd.org/c/openocd/+/7139

-- gerrit

commit f3465b9e5a102fed6400e236e6a01c4415d507fc
Author: iysheng <iyysh...@gmail.com>
Date:   Sun Aug 21 10:19:12 2022 +0800

    target/xtensa: Fix compile error with gcc 12.1.1
    
    using gcc version 12.1.1 20220522 (Solus) we get:
    error: 'a3' may be used uninitialized [-Werror=maybe-uninitialized]
    error: '%04x' directive writing between 4 and 8 bytes into a region of size 
5 [-Werror=format-overflow=]
    
    Signed-off-by: iysheng <iyysh...@gmail.com>
    Change-Id: Iec7888318811020285282c8a04aa1a94cd958902

diff --git a/src/target/xtensa/xtensa.c b/src/target/xtensa/xtensa.c
index fe0f43882b..c3da86b43d 100644
--- a/src/target/xtensa/xtensa.c
+++ b/src/target/xtensa/xtensa.c
@@ -591,7 +591,7 @@ static int xtensa_write_dirty_registers(struct target 
*target)
        unsigned int reg_list_size = xtensa->core_cache->num_regs;
        bool preserve_a3 = false;
        uint8_t a3_buf[4];
-       xtensa_reg_val_t a3, woe;
+       xtensa_reg_val_t a3 = 0, woe;
 
        LOG_TARGET_DEBUG(target, "start");
 
@@ -2468,7 +2468,7 @@ static int xtensa_build_reg_cache(struct target *target)
                        LOG_TARGET_ERROR(target, "ERROR: Out of memory");
                        goto fail;
                }
-               sprintf((char *)xtensa->empty_regs[i].name, "?0x%04x", i);
+               sprintf((char *)xtensa->empty_regs[i].name, "?0x%04x", i & 
0xffff);
                xtensa->empty_regs[i].size = 32;
                xtensa->empty_regs[i].type = &xtensa_reg_type;
                xtensa->empty_regs[i].value = calloc(1, 4 /*XT_REG_LEN*/);      
/* make Clang Static Analyzer happy */

-- 

Reply via email to