Message ID | 20200108023915.52288-1-pannengyuan@huawei.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [v2] arm/translate-a64: fix uninitialized variable warning | expand |
On 1/8/20 12:39 PM, pannengyuan@huawei.com wrote: > From: Pan Nengyuan <pannengyuan@huawei.com> > > Fixes: > target/arm/translate-a64.c: In function 'disas_crypto_three_reg_sha512': > target/arm/translate-a64.c:13625:9: error: 'genfn' may be used uninitialized in this function [-Werror=maybe-uninitialized] > genfn(tcg_rd_ptr, tcg_rn_ptr, tcg_rm_ptr); > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > qemu/target/arm/translate-a64.c:13609:8: error: 'feature' may be used uninitialized in this function [-Werror=maybe-uninitialized] > if (!feature) { > > Reported-by: Euler Robot <euler.robot@huawei.com> > Signed-off-by: Pan Nengyuan <pannengyuan@huawei.com> > --- > Changes v2 to v1: > - add a default label to fix uninitialized warnings(suggested by Richard Henderson) > --- > target/arm/translate-a64.c | 2 ++ > 1 file changed, 2 insertions(+) Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Given that you are using -O2, this should probably also be reported as a GCC bug. r~
On 1/8/20 3:39 AM, pannengyuan@huawei.com wrote: > From: Pan Nengyuan <pannengyuan@huawei.com> > > Fixes: > target/arm/translate-a64.c: In function 'disas_crypto_three_reg_sha512': > target/arm/translate-a64.c:13625:9: error: 'genfn' may be used uninitialized in this function [-Werror=maybe-uninitialized] > genfn(tcg_rd_ptr, tcg_rn_ptr, tcg_rm_ptr); > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > qemu/target/arm/translate-a64.c:13609:8: error: 'feature' may be used uninitialized in this function [-Werror=maybe-uninitialized] > if (!feature) { > > Reported-by: Euler Robot <euler.robot@huawei.com> > Signed-off-by: Pan Nengyuan <pannengyuan@huawei.com> > --- > Changes v2 to v1: > - add a default label to fix uninitialized warnings(suggested by Richard Henderson) > --- > target/arm/translate-a64.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c > index d4bebbe629..63a3d26687 100644 > --- a/target/arm/translate-a64.c > +++ b/target/arm/translate-a64.c > @@ -13585,6 +13585,8 @@ static void disas_crypto_three_reg_sha512(DisasContext *s, uint32_t insn) > feature = dc_isar_feature(aa64_sha3, s); > genfn = NULL; > break; > + default: > + g_assert_not_reached(); > } > } else { > switch (opcode) { > Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Le 08/01/2020 à 03:39, pannengyuan@huawei.com a écrit : > From: Pan Nengyuan <pannengyuan@huawei.com> > > Fixes: > target/arm/translate-a64.c: In function 'disas_crypto_three_reg_sha512': > target/arm/translate-a64.c:13625:9: error: 'genfn' may be used uninitialized in this function [-Werror=maybe-uninitialized] > genfn(tcg_rd_ptr, tcg_rn_ptr, tcg_rm_ptr); > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > qemu/target/arm/translate-a64.c:13609:8: error: 'feature' may be used uninitialized in this function [-Werror=maybe-uninitialized] > if (!feature) { > > Reported-by: Euler Robot <euler.robot@huawei.com> > Signed-off-by: Pan Nengyuan <pannengyuan@huawei.com> > --- > Changes v2 to v1: > - add a default label to fix uninitialized warnings(suggested by Richard Henderson) > --- > target/arm/translate-a64.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c > index d4bebbe629..63a3d26687 100644 > --- a/target/arm/translate-a64.c > +++ b/target/arm/translate-a64.c > @@ -13585,6 +13585,8 @@ static void disas_crypto_three_reg_sha512(DisasContext *s, uint32_t insn) > feature = dc_isar_feature(aa64_sha3, s); > genfn = NULL; > break; > + default: > + g_assert_not_reached(); > } > } else { > switch (opcode) { > Applied to my trivial-patches branch. Thanks, Laurent
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index d4bebbe629..63a3d26687 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -13585,6 +13585,8 @@ static void disas_crypto_three_reg_sha512(DisasContext *s, uint32_t insn) feature = dc_isar_feature(aa64_sha3, s); genfn = NULL; break; + default: + g_assert_not_reached(); } } else { switch (opcode) {