Fix places in the AArch64 opcodes library code where a call to assert() has side...
authorNick Clifton <nickc@redhat.com>
Fri, 8 Jan 2021 11:51:50 +0000 (11:51 +0000)
committerNick Clifton <nickc@redhat.com>
Fri, 8 Jan 2021 11:51:50 +0000 (11:51 +0000)
PR 27129
* aarch64-dis.c (determine_disassembling_preference): Move call to
aarch64_match_operands_constraint outside of the assertion.
* aarch64-asm.c (aarch64_ins_limm_1): Remove call to assert.
Replace with a return of FALSE.

opcodes/ChangeLog
opcodes/aarch64-asm.c
opcodes/aarch64-dis.c

index 0eef3ab55ead870cbf7e6d899133a735239ce200..8b25c41a843d01d060ab24ad2f61f1d02d0b879f 100644 (file)
@@ -1,5 +1,11 @@
 2021-01-08  Nick Clifton  <nickc@redhat.com>
 
+       PR 27129
+       * aarch64-dis.c (determine_disassembling_preference): Move call to
+       aarch64_match_operands_constraint outside of the assertion.
+       * aarch64-asm.c (aarch64_ins_limm_1): Remove call to assert.
+       Replace with a return of FALSE.
+
        PR 27139
        * aarch64-opc.c (aarch64_sys_regs): Treat id_aa64mmfr2_el1 as a
        core system register.
index 0eebf6bae2c288aec4081bdb3b13e5c4e420448f..eae652e27146e5926fa8071d3869a9386ad22228 100644 (file)
@@ -545,18 +545,19 @@ aarch64_ins_limm_1 (const aarch64_operand *self,
                    const aarch64_inst *inst, bfd_boolean invert_p,
                    aarch64_operand_error *errors ATTRIBUTE_UNUSED)
 {
+  bfd_boolean res;
   aarch64_insn value;
   uint64_t imm = info->imm.value;
   int esize = aarch64_get_qualifier_esize (inst->operands[0].qualifier);
 
   if (invert_p)
     imm = ~imm;
-  /* The constraint check should have guaranteed this wouldn't happen.  */
-  assert (aarch64_logical_immediate_p (imm, esize, &value));
-
-  insert_fields (code, value, 0, 3, self->fields[2], self->fields[1],
-                self->fields[0]);
-  return TRUE;
+  /* The constraint check should guarantee that this will work.  */
+  res = aarch64_logical_immediate_p (imm, esize, &value);
+  if (res)
+    insert_fields (code, value, 0, 3, self->fields[2], self->fields[1],
+                  self->fields[0]);
+  return res;
 }
 
 /* Insert logical/bitmask immediate for e.g. the last operand in
index da1c96dadc1e4a2fadc06a654b27c622b102f32e..19482f729ab77329b97d8a82803c63a4bdc16b3b 100644 (file)
@@ -2729,8 +2729,10 @@ determine_disassembling_preference (struct aarch64_inst *inst,
             successfully converted to the form of ALIAS.  */
          if (convert_to_alias (&copy, alias) == 1)
            {
+             int res;
              aarch64_replace_opcode (&copy, alias);
-             assert (aarch64_match_operands_constraint (&copy, NULL));
+             res = aarch64_match_operands_constraint (&copy, NULL);
+             assert (res == 1);
              DEBUG_TRACE ("succeed with %s via conversion", alias->name);
              memcpy (inst, &copy, sizeof (aarch64_inst));
              return;