arm64: add two initializers

Message ID a7641953-5ee0-f20d-f1df-f7836bdc1fa3@suse.com
State New
Headers show
Series
  • arm64: add two initializers
Related show

Commit Message

Alan Modra via Binutils March 22, 2021, 8:32 a.m.
Old enough gcc can't cope and would warn about the variables potentially
remaining uninitialized.

opcodes/
2021-03-XX  Jan Beulich  <jbeulich@suse.com>

	* aarch64-asm.c (encode_asimd_fcvt): Add initializer for
	"qualifier".
	(convert_mov_to_movewide): Add initializer for "value".

Comments

Alan Modra via Binutils April 19, 2021, 11:31 a.m. | #1
On 22.03.2021 09:32, Jan Beulich via Binutils wrote:
> Old enough gcc can't cope and would warn about the variables potentially

> remaining uninitialized.

> 

> opcodes/

> 2021-03-XX  Jan Beulich  <jbeulich@suse.com>

> 

> 	* aarch64-asm.c (encode_asimd_fcvt): Add initializer for

> 	"qualifier".

> 	(convert_mov_to_movewide): Add initializer for "value".


As I'm unconvinced that such a change can really be considered trivial,
may I ask for an okay or otherwise?

Thanks, Jan

> --- a/opcodes/aarch64-asm.c

> +++ b/opcodes/aarch64-asm.c

> @@ -1335,7 +1335,7 @@ encode_asimd_fcvt (aarch64_inst *inst)

>  {

>    aarch64_insn value;

>    aarch64_field field = {0, 0};

> -  enum aarch64_opnd_qualifier qualifier;

> +  enum aarch64_opnd_qualifier qualifier = AARCH64_OPND_QLF_NIL;

>  

>    switch (inst->opcode->op)

>      {

> @@ -1893,7 +1893,7 @@ convert_mov_to_movewide (aarch64_inst *i

>  {

>    int is32;

>    uint32_t shift_amount;

> -  uint64_t value;

> +  uint64_t value = ~(uint64_t)0;

>  

>    switch (inst->opcode->op)

>      {

>
Alan Modra via Binutils April 19, 2021, 1:17 p.m. | #2
Hi Jan,

>> opcodes/

>> 2021-03-XX  Jan Beulich  <jbeulich@suse.com>

>>

>> 	* aarch64-asm.c (encode_asimd_fcvt): Add initializer for

>> 	"qualifier".

>> 	(convert_mov_to_movewide): Add initializer for "value".


Approved - please apply.

Cheers
   Nick

Patch

--- a/opcodes/aarch64-asm.c
+++ b/opcodes/aarch64-asm.c
@@ -1335,7 +1335,7 @@  encode_asimd_fcvt (aarch64_inst *inst)
 {
   aarch64_insn value;
   aarch64_field field = {0, 0};
-  enum aarch64_opnd_qualifier qualifier;
+  enum aarch64_opnd_qualifier qualifier = AARCH64_OPND_QLF_NIL;
 
   switch (inst->opcode->op)
     {
@@ -1893,7 +1893,7 @@  convert_mov_to_movewide (aarch64_inst *i
 {
   int is32;
   uint32_t shift_amount;
-  uint64_t value;
+  uint64_t value = ~(uint64_t)0;
 
   switch (inst->opcode->op)
     {