bad register name `%sil'

YONETANI Tomokazu qhwt+dragonfly-bugs at
Sun Feb 1 09:00:15 PST 2004

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_pageout.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

#include <sys/param.h>
#include <sys/systm.h>

typedef struct {
	u_short flags, paging_in_progress;
} *o_t;

typedef struct {
	u_short flags;
	u_char busy;
	o_t object;
} *p_t;

void foo(o_t);
void foo2(p_t);
int baz(p_t *mc, int count, int flags);

baz(p_t *mc, int count, int flags)
	o_t object;
	p_t mt;
	int i;

	for (i = 0; i < count; i++) {
		mt = mc[i];
		atomic_add_char(&mt->busy, 1);
		if (mt->flags) {
			atomic_clear_short(&mt->flags, 0x10);

	object = mc[0]->object;

	for (i = 0; i < count; i++) {
		mt = mc[i];
		atomic_clear_short(&object->flags, 0x40);
		atomic_subtract_char(&mt->busy, 1);
	return 0;

More information about the Bugs mailing list