Q: Is this improper asm use or a bug?

Fred Fish fnf@intrinsity.com
Wed Jun 11 22:02:00 GMT 2003


> >                     : "+r" (loops)
> >                     : "0" (loops));
> 
> Use either "=r" and "0", or just "+r".  Since input and output are the

That didn't have any effect.

BTW, the problem is reproducible using the system gcc supplied with
RedHat 9.0 and comparing with the output of a recent CVS toolchain.
Note that the "movl $50000, %eax" instruction is missing with the
recent CVS toolchain:

	$ gcc -S -O2 b.i
	$ mv b.s b.s.old
	$ /usr/local/sourceware/bin/i686-pc-linux-gnu-gcc -S -O2 b.i
	$ diff -c b.s.old b.s
	*** b.s.old     2003-06-11 14:54:22.000000000 -0700
	--- b.s 2003-06-11 14:54:29.000000000 -0700
	***************
	*** 1,20 ****
	        .file   "b.i"
	        .text
	!       .p2align 2,,3
	  .globl func
	!       .type   func,@function
	  func:
	        pushl   %ebp
	        movl    %esp, %ebp
	-       movl    $50000, %eax
	  #APP
	        .set    noreorder
	  1:    bnez    %eax,1b
	        subu    %eax,1
	        .set    reorder
	  #NO_APP
	!       leave
	        ret
	! .Lfe1:
	!       .size   func,.Lfe1-func
	!       .ident  "GCC: (GNU) 3.2.2 20030222 (Red Hat Linux 3.2.2-5)"
	--- 1,18 ----
	        .file   "b.i"
	        .text
	!       .p2align 4,,15
	  .globl func
	!       .type   func, @function
	  func:
	        pushl   %ebp
	        movl    %esp, %ebp
	  #APP
	        .set    noreorder
	  1:    bnez    %eax,1b
	        subu    %eax,1
	        .set    reorder
	  #NO_APP
	!       popl    %ebp
	        ret
	!       .size   func, .-func
	!       .ident  "GCC: (GNU) 3.4 20030525 (experimental)"
	
-Fred



More information about the Gcc mailing list