S/390: Improve error checking for optional operands
[deliverable/binutils-gdb.git] / opcodes / s390-dis.c
index 8d450b4664e8f49c3231d6239777b8de7a046c50..16bb5ff7c5997ee1fc3ae0f1f9acdc019c876de0 100644 (file)
@@ -206,11 +206,20 @@ s390_print_insn_with_opcode (bfd_vma memaddr,
 
       /* For instructions with a last optional operand don't print it
         if zero.  */
-      if ((opcode->flags & S390_INSTR_FLAG_OPTPARM)
+      if ((opcode->flags & (S390_INSTR_FLAG_OPTPARM | S390_INSTR_FLAG_OPTPARM2))
          && val.u == 0
          && opindex[1] == 0)
        break;
 
+      if ((opcode->flags & S390_INSTR_FLAG_OPTPARM2)
+         && val.u == 0 && opindex[1] != 0 && opindex[2] == 0)
+       {
+         union operand_value next_op_val =
+           s390_extract_operand (buffer, s390_operands + opindex[1]);
+         if (next_op_val.u == 0)
+           break;
+       }
+
       if (flags & S390_OPERAND_GPR)
        info->fprintf_func (info->stream, "%c%%r%u", separator, val.u);
       else if (flags & S390_OPERAND_FPR)
This page took 0.024743 seconds and 4 git commands to generate.