From: Sergio Durigan Junior Date: Thu, 21 Sep 2017 15:46:48 +0000 (-0400) Subject: Initialize 'imm' on opcodes/aarch64-opc.c:expand_fp_imm (and fix breakage on mingw) X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=57a024f4650d7562e963efb6b00c4a4cd74185c4;hp=5b3fd0aac2b70d860ba34f0e290d87773b09bd11;p=deliverable%2Fbinutils-gdb.git Initialize 'imm' on opcodes/aarch64-opc.c:expand_fp_imm (and fix breakage on mingw) Hi, While compiling GDB using a mingw compiler from Fedora 26: ../gdb/configure --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 \ --disable-binutils --disable-ld --disable-gold --disable-gas --disable-sim \ --disable-gprof --enable-targets=all I stumbled upon a simple occurrence of -Werror=maybe-uninitialized: ../../gdb/opcodes/aarch64-opc.c: In function 'expand_fp_imm': ../../gdb/opcodes/aarch64-opc.c:2880:10: error: 'imm' may be used uninitialized in this function [-Werror=maybe-uninitialized] return imm; ^~~ It is the compiler's fault, because this function always assigns to 'imm' if the necessary conditions are met, and it calls "assert (0)" otherwise, but I thought it'd be clearer to have 'imm' explicitly set to zero anyway. opcodes/ChangeLog: 2017-09-21 Sergio Durigan Junior * aarch64-opc.c (expand_fp_imm): Initialize 'imm'. --- diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index 4974791184..082d7554ec 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,3 +1,7 @@ +2017-09-21 Sergio Durigan Junior + + * aarch64-opc.c (expand_fp_imm): Initialize 'imm'. + 2017-09-09 Kamil Rytarowski * nds32-asm.c: Rename __BIT() to N32_BIT(). diff --git a/opcodes/aarch64-opc.c b/opcodes/aarch64-opc.c index 27c1d09080..c93a90ac64 100644 --- a/opcodes/aarch64-opc.c +++ b/opcodes/aarch64-opc.c @@ -2847,7 +2847,7 @@ typedef union static uint64_t expand_fp_imm (int size, uint32_t imm8) { - uint64_t imm; + uint64_t imm = 0; uint32_t imm8_7, imm8_6_0, imm8_6, imm8_6_repl4; imm8_7 = (imm8 >> 7) & 0x01; /* imm8<7> */