GAS bug when dividing constants

Bob Plantz plantz@cds1.net
Mon Mar 30 03:08:00 GMT 2009


On Sun, 2009-03-29 at 18:20 -0700, H.J. Lu wrote:
> On Sun, Mar 29, 2009 at 6:07 PM, Bogdan <love4boobies@yahoo.com> wrote:
> >
> > This works
> >
> > MOV 2 + 2, %AX
> >
> > while this fails
> >
> > MOV 2 / 2, %AX
> >
> > Probably an easy-to-fix preprocessor bug.
> >
> > Cheers.
> 
> Works for me:
> 
> 
> bash-3.2$ cat x.s
> MOV 2 / 2, %AX
> bash-3.2$ gcc -c x.s
> bash-3.2$ objdump -dw x.o
> 
> x.o:     file format elf64-x86-64
> 
> 
> Disassembly of section .text:
> 
> 0000000000000000 <.text>:
>    0:	66 8b 04 25 01 00 00 00 	mov    0x1,%ax
> bash-3.2$
> 
> 

And for me:
GAS LISTING gas_const.s 			page 1


   1              		.text
   2              		.globl	main
   3 0000 55       	main:	pushq	%rbp
   4 0001 4889E5   		movq	%rsp, %rbp
   5              		
   6 0004 668B0425 		mov     2 + 2, %ax
   6      04000000 
   7 000c 668B0425 		mov     2 / 2, %ax
   7      01000000 
   8 0014 668B0425 		mov     1, %ax
   8      01000000 
   9              		
  10 001c B8000000 		movl	$0, %eax
  10      00
  11 0021 4889EC   		movq	%rbp, %rsp
  12 0024 5D       		popq	%rbp
  13 0025 C3       		ret
  14              	



More information about the Binutils mailing list