bad register name `%sil'

YONETANI Tomokazu qhwt+dragonfly-bugs at les.ath.cx
Sun Feb 1 15:11:28 PST 2004


Hi,

On Sun, Feb 01, 2004 at 11:37:39AM -0800, Kip Macy wrote:
> My first guess would be that that is a binutils issue. In other
> words, the assembler might not be up to date with the compiler.

The weird thing, howerver, is that the instruction doesn't even
assemble on FreeBSD-CURRENT:

$ cat a.s
        addb %sil,2(%ebx)
$ gcc a.s
a.s: Assembler messages:
a.s:1: Error: bad register name `%sil'
$ gcc -v
Using built-in specs.
Configured with: FreeBSD/i386 system compiler
Thread model: posix
gcc version 3.3.3 [FreeBSD] 20031106
$ as --version | head -1
GNU assembler 2.13.2 [FreeBSD] 2002-11-27
$ type gcc as
gcc is /usr/bin/gcc
as is /usr/bin/as

FreeBSD-CURRENT version of gcc-3.3.3 does't seem to produce this operand
for the same .c file and the same command line arguments. Here's the
diff between the assembly codes from our gcc and FreeBSD-CURRENT's gcc:

--- p4.s	Mon Feb  2 08:06:23 2004
+++ p4-5.s	Mon Feb  2 08:06:33 2004
@@ -16,8 +16,9 @@
 .L9:
 	movl	8(%ebp), %eax
 	movl	(%eax,%edi,4), %ebx
+	movl	%esi, %edx
 #APP
-	addb %sil,2(%ebx)
+	addb %dl,2(%ebx)
 #NO_APP
 	cmpw	$0, (%ebx)
 	ds ; je	.L4

Maybe we need to examine the FreeBSD-CURRENT's gcc to see if there's
local-hacks that we're missing.

> On Mon, 2 Feb 2004, YONETANI Tomokazu wrote:
> 
> > Hello.
> > Is our gcc3 known to produce a bad code when '-O -march=pentium4'
> > are specified? This is from buildkernel(sorry, very long lines):
> >
> > cc -c -O -pipe -march=pentium4 -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes  -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual  -fformat-extensions -ansi -g -nostdinc -I. -I/home/source/dragonfly/src/sys -I/home/source/dragonfly/src/sys/../include -I/home/source/dragonfly/src/sys/contrib/dev/acpica -I/home/source/dragonfly/src/sys/contrib/ipfilter  -D_KERNEL -include opt_global.h  -mpreferred-stack-boundary=2 -ffreestanding  /home/source/dragonfly/src/sys/vm/vm_pageo
ut.c
> > {standard input}: Assembler messages:
> > {standard input}:751: Error: bad register name `%sil'
> > *** Error code 1
> >
> > It always fails at vm_pageout.c, and the code in question is in the
> > function vm_pageout_flush(). If I replace '-O' with '-O2', the reference
> > to `%sil' disappears from the assembly code.
> >
> > The following is minimum code example to reproduce this.
> >
> > $ CCVER=gcc3 cc -S -o a.s -O -pipe -march=pentium4 -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes  -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual  -fformat-extensions -ansi -g -D_KERNEL -mpreferred-stack-boundary=2 -ffreestanding  a.c
> > $ cat ~/a.c
> >
[snip the rest of the code]





More information about the Bugs mailing list