Fix mips_ip for correct error message

Fu, Chao-Ying fu@mips.com
Mon Jul 21 18:11:00 GMT 2008


Nick Clifton wrote:
> 
> Hi Chao-Ying,
> 
> >   In "mips_ip", the error handling code forgets to reset s 
> to argsStart,
> > such that the instruction string is incomplete.
> 
> Good catch, but doesn't the same problem occur earlier on, ie 
> line 8604:
> 
> 	      if (save_c)
> 		*(--s) = save_c;
> 	      return;

  Before running to line 8604, s just enters the loop with 
correct value or is reset to argsStart due to the bottom of the loop
on line 9956.
Ex:
      /* Args don't match.  */
      if (insn + 1 < &mips_opcodes[NUMOPCODES] &&
          !strcmp (insn->name, insn[1].name))
        {
          ++insn;
          s = argsStart;
          insn_error = _("illegal operands");
          continue;
        }

> 
> Also there is no point in reassigning the value of the "s" 
> variable when 
> you can just use argsStart directly,  ie:
> 
>          if (save_c)
>            * argsStart = save_c;
> 
> Please could you try out two changes to see if any more tweaks are 
> needed to the testsuite and then resubmit your patch.
> 

  Yes, we can save one line by using argsStart directly.  However,
we still need to decrement argsStart to make it work.
Please check my updated patch.  Thanks a lot!

Regards,
Chao-ying

Ex: (test results)
                === gas Summary ===

# of expected passes            817
# of expected failures          1
../as-new 2.18.50.20080718

gas/ChangeLog
2008-07-21  Chao-ying Fu  <fu@mips.com>

	* config/tc-mips.c (mips_ip): Reset s to argsStart.

gas/testsuite/ChangeLog
2008-07-21  Chao-ying Fu  <fu@mips.com>

	* gas/mips/tls-ill.l: Update error message.
	* gas/mips/octeon-ill.l: Likewise.

Index: gas/config/tc-mips.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-mips.c,v
retrieving revision 1.390
diff -u -p -r1.390 tc-mips.c
--- gas/config/tc-mips.c        10 Jul 2008 19:05:29 -0000      1.390
+++ gas/config/tc-mips.c        21 Jul 2008 18:02:09 -0000
@@ -9958,7 +9958,7 @@ do_msbd:
          continue;
        }
       if (save_c)
-       *(--s) = save_c;
+       *(--argsStart) = save_c;
       insn_error = _("illegal operands");
       return;
     }

Index: octeon-ill.l
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/mips/octeon-ill.l,v
retrieving revision 1.3
diff -u -p -r1.3 octeon-ill.l
--- octeon-ill.l        7 Jul 2008 19:28:02 -0000       1.3
+++ octeon-ill.l        21 Jul 2008 18:03:04 -0000
@@ -31,9 +31,9 @@
 .*:45: Error: expression out of range
 .*:46: Error: expression out of range
 .*:47: Error: register value used as expression
-.*:48: Error: illegal operands `dmfc2'
+.*:48: Error: illegal operands `dmfc2 \$4,\$15,4'
 .*:49: Error: register value used as expression
-.*:50: Error: illegal operands `dmtc2'
+.*:50: Error: illegal operands `dmtc2 \$22,\$7,\$4'
 .*:52: Error: Improper size \(32\)
 .*:54: Error: Improper position \(32\)
 .*:55: Error: Improper size \(29\)
Index: tls-ill.l
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/mips/tls-ill.l,v
retrieving revision 1.1
diff -u -p -r1.1 tls-ill.l
--- tls-ill.l   2 Mar 2005 21:22:47 -0000       1.1
+++ tls-ill.l   21 Jul 2008 18:03:04 -0000
@@ -1,11 +1,11 @@
 .*: Assembler messages:
 .*:6: Error: bad expression
-.*:6: Error: illegal operands `addiu'
+.*:6: Error: illegal operands `addiu \$4,\$28,%dtprel\(tlsvar\)'
 .*:7: Error: bad expression
-.*:7: Error: illegal operands `addiu'
+.*:7: Error: illegal operands `addiu \$4,\$28,%tprel\(tlsvar\)'
 .*:8: Error: bad expression
 .*:8: Error: missing '\)'
-.*:8: Error: illegal operands `addiu'
+.*:8: Error: illegal operands `addiu \$4,\$28,%lo\(%gottprel\(tlsvar\)\)'
 .*:9: Error: bad expression
 .*:9: Error: missing '\)'
-.*:9: Error: illegal operands `addiu'
+.*:9: Error: illegal operands `addiu \$4,\$28,%hi\(%gottprel\(tlsvar\)\)'



More information about the Binutils mailing list