i386 intel_syntax as segv

Richard Henderson rth@cygnus.com
Wed Feb 23 16:45:00 GMT 2000


Fixes

	.intel_syntax
        mov     %ax,%ds

Swapping null entries in the register array seemed easier
than enumerating the gazillions of register types.


r~


2000-02-23  Richard Henderson  <rth@cygnus.com>

        * config/tc-i386.c (md_assemble): When swapping operands for
        intel_syntax, assume everything that's not Imm or Disp is a
        register.

Index: tc-i386.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-i386.c,v
retrieving revision 1.34
diff -c -p -d -r1.34 tc-i386.c
*** tc-i386.c	2000/02/21 12:01:26	1.34
--- tc-i386.c	2000/02/24 00:41:55
*************** md_assemble (line)
*** 1298,1318 ****
  	if (i.operands > 1)
  	  {
  	    temp_type = i.types[xchg2];
! 	    if (temp_type & (Reg | FloatReg))
! 	      temp_reg = i.regs[xchg2];
! 	    else if (temp_type & Imm)
  	      temp_imm = i.imms[xchg2];
  	    else if (temp_type & Disp)
  	      temp_disp = i.disps[xchg2];
  
  	    i.types[xchg2] = i.types[xchg1];
  
! 	    if (i.types[xchg1] & (Reg | FloatReg))
! 	      {
! 		i.regs[xchg2] = i.regs[xchg1];
! 		i.regs[xchg1] = NULL;
! 	      }
! 	    else if (i.types[xchg2] & Imm)
  	      {
  		i.imms[xchg2] = i.imms[xchg1];
  		i.imms[xchg1] = NULL;
--- 1298,1313 ----
  	if (i.operands > 1)
  	  {
  	    temp_type = i.types[xchg2];
! 	    if (temp_type & Imm)
  	      temp_imm = i.imms[xchg2];
  	    else if (temp_type & Disp)
  	      temp_disp = i.disps[xchg2];
+ 	    else
+ 	      temp_reg = i.regs[xchg2];
  
  	    i.types[xchg2] = i.types[xchg1];
  
! 	    if (i.types[xchg2] & Imm)
  	      {
  		i.imms[xchg2] = i.imms[xchg1];
  		i.imms[xchg1] = NULL;
*************** md_assemble (line)
*** 1322,1335 ****
  		i.disps[xchg2] = i.disps[xchg1];
  		i.disps[xchg1] = NULL;
  	      }
! 
! 	    if (temp_type & (Reg | FloatReg))
  	      {
! 		i.regs[xchg1] = temp_reg;
! 		if (! (i.types[xchg1] & (Reg | FloatReg)))
! 		  i.regs[xchg2] = NULL;
  	      }
! 	    else if (temp_type & Imm)
  	      {
  		i.imms[xchg1] = temp_imm;
  		if (! (i.types[xchg1] & Imm))
--- 1317,1329 ----
  		i.disps[xchg2] = i.disps[xchg1];
  		i.disps[xchg1] = NULL;
  	      }
! 	    else
  	      {
! 		i.regs[xchg2] = i.regs[xchg1];
! 		i.regs[xchg1] = NULL;
  	      }
! 
! 	    if (temp_type & Imm)
  	      {
  		i.imms[xchg1] = temp_imm;
  		if (! (i.types[xchg1] & Imm))
*************** md_assemble (line)
*** 1340,1345 ****
--- 1334,1345 ----
  		i.disps[xchg1] = temp_disp;
  		if (! (i.types[xchg1] & Disp))
  		  i.disps[xchg2] = NULL;
+ 	      }
+ 	    else
+ 	      {
+ 		i.regs[xchg1] = temp_reg;
+ 		if (i.types[xchg1] & (Imm | Disp))
+ 		  i.regs[xchg2] = NULL;
  	      }
  
  	    i.types[xchg1] = temp_type;


More information about the Binutils mailing list