[binutils-gdb] [sim, rx] Silence warning that turns into a build error

Luis Machado luisgpm@sourceware.org
Fri Apr 9 12:18:16 GMT 2021


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=ed29efbd172e04b53d1f9ddab64e6e0cf6dceaf2

commit ed29efbd172e04b53d1f9ddab64e6e0cf6dceaf2
Author: Luis Machado <luis.machado@linaro.org>
Date:   Thu Apr 8 16:49:04 2021 -0300

    [sim,rx] Silence warning that turns into a build error
    
    On a 32-bit build, I ran into the following:
    
    sim/rx/fpu.c:789:6: error: "*((void *)&a+8)" may be used uninitialized in this function [-Werror=maybe-uninitialized]
    rv = fp_implode (&a);
    
    To silence this, just initialize the struct with 0's.
    
    sim/rx/ChangeLog:
    
    2021-04-09  Luis Machado  <luis.machado@linaro.org>
    
            * fpu.c (rxfp_itof): Initialize structure.

Diff:
---
 sim/rx/fpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sim/rx/fpu.c b/sim/rx/fpu.c
index f9e9007192a..6c4738c0b21 100644
--- a/sim/rx/fpu.c
+++ b/sim/rx/fpu.c
@@ -732,7 +732,7 @@ rxfp_itof (long fa, int round_mode)
   int sign = 0;
   unsigned int frac_bits;
   volatile unsigned int whole_bits;
-  FP_Parts a;
+  FP_Parts a = {0};
 
   if (fa == 0)
     return PLUS_ZERO;


More information about the Gdb-cvs mailing list