This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

sh assembler mis-assembles @(r0) and @(r0,)


@(r0) must be spelled @r0, and @(r0,) is clearly incorrect, yet the
assembler would silently parse both of them as @(r0,r0).  This patch
fixes this problem, as well as making sure we report an error should
the comma between the register names in @(r0,r1) be missing.  Ok to
install?

Index: gas/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	* config/tc-sh.c (parse_at): Reject @(r0) and @(r0,).

Index: gas/config/tc-sh.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-sh.c,v
retrieving revision 1.49
diff -u -p -c -r1.49 tc-sh.c
*** gas/config/tc-sh.c 2001/12/05 09:52:32 1.49
--- gas/config/tc-sh.c 2001/12/14 13:46:34
*************** parse_at (src, op)
*** 925,944 ****
  	      as_bad (_("must be @(r0,...)"));
  	    }
  	  if (src[0] == ',')
- 	    src++;
- 	  /* Now can be rn or gbr */
- 	  len = parse_reg (src, &mode, &(op->reg));
- 	  if (mode == A_GBR)
  	    {
! 	      op->type = A_R0_GBR;
  	    }
! 	  else if (mode == A_REG_N)
  	    {
! 	      op->type = A_IND_R0_REG_N;
  	    }
  	  else
  	    {
! 	      as_bad (_("syntax error in @(r0,...)"));
  	    }
  	}
        else
--- 925,957 ----
  	      as_bad (_("must be @(r0,...)"));
  	    }
  	  if (src[0] == ',')
  	    {
! 	      src++;
! 	      /* Now can be rn or gbr */
! 	      len = parse_reg (src, &mode, &(op->reg));
  	    }
! 	  else
! 	    {
! 	      len = 0;
! 	    }
! 	  if (len)
  	    {
! 	      if (mode == A_GBR)
! 		{
! 		  op->type = A_R0_GBR;
! 		}
! 	      else if (mode == A_REG_N)
! 		{
! 		  op->type = A_IND_R0_REG_N;
! 		}
! 	      else
! 		{
! 		  as_bad (_("syntax error in @(r0,...)"));
! 		}
  	    }
  	  else
  	    {
! 	      as_bad (_("syntax error in @(r0...)"));
  	    }
  	}
        else

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]