Patch SH Assembler: Generates error in case of instruction mov #Imm,rd

Anil Paranjape AnilP1@KPITCummins.com
Fri Feb 27 11:36:00 GMT 2004


Hi,

In case of following instruction for SH,
	mov #H'0f,r10
SH ELF assembler crashes and gives segmentation fault. 
Instead SH ELF assembler should give error for wrong syntax.

Please find patch below which fixes this problem in SH assembler.
No new regressions found in DejaGnu testsuite after pacth.

ChangeLog:

2004-02-26  Anil Paranjpe  <anilp1@kpitcummins.com>
	 * config/tc-sh.c (get_operand) :  In case of #Imm, check has been added for wrong syntax.

--- binutils-040224/gas/config/tc-sh.c.old  Fri Dec  5 17:25:02 2003
+++ binutils-040224/gas/config/tc-sh.c	    Thu Feb 26 17:00:07 2004
@@ -1426,6 +1426,8 @@ get_operand (char **ptr, sh_operand_info
 
   if (src[0] == '#')
     {
+	  if( !isdigit(src[1]) )
+	     as_bad (_("syntax error in #Imm"));
       src++;
       *ptr = parse_exp (src, op);
       op->type = A_IMM;

Regards,
Anil



More information about the Binutils mailing list