]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Fix potential use on an uninitialised vairable in the MCore assembler.
authorNick Clifton <nickc@redhat.com>
Mon, 6 Sep 2021 09:52:49 +0000 (10:52 +0100)
committerNick Clifton <nickc@redhat.com>
Mon, 6 Sep 2021 09:52:49 +0000 (10:52 +0100)
gas/config/tc-mcore.c

index 443253f396415192eb5c14060bf04d81b83285f9..d030b6f95c1798265a1856cf16da90bcdfee977f 100644 (file)
@@ -852,7 +852,7 @@ md_assemble (char * str)
   char * op_start;
   char * op_end;
   mcore_opcode_info * opcode;
-  char * output;
+  char * output = NULL;
   int nlen = 0;
   unsigned short inst;
   unsigned reg;
@@ -1596,8 +1596,11 @@ md_assemble (char * str)
   if (strcmp (op_end, opcode->name) && strcmp (op_end, ""))
     as_warn (_("ignoring operands: %s "), op_end);
 
-  output[0] = INST_BYTE0 (inst);
-  output[1] = INST_BYTE1 (inst);
+  if (output != NULL)
+    {
+      output[0] = INST_BYTE0 (inst);
+      output[1] = INST_BYTE1 (inst);
+    }
 
 #ifdef OBJ_ELF
   dwarf2_emit_insn (2);