[sim,rx] Silence warning that turns into a build error
authorLuis Machado <luis.machado@linaro.org>
Thu, 8 Apr 2021 19:49:04 +0000 (16:49 -0300)
committerLuis Machado <luis.machado@linaro.org>
Fri, 9 Apr 2021 12:17:32 +0000 (09:17 -0300)
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.

sim/rx/fpu.c

index f9e9007192a8ea3b26ec47cb56296ddd8baac8d7..6c4738c0b21d338705acfe6eae4449f9d61801c3 100644 (file)
@@ -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;