Port-vax archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

gcc vax bug in built-in ffs function/displacement indexed addressing


I fought against SCSI problems on my VS4000/96 and /60 with NetBSD-current:

It was related to tagged queueing somehow, but finally turned out to be
a gcc bug in the built-in ffs function (used in scsipi_get_tag()) and/or
"byte displacement indexed" addressing mode.

Above PR says it all, but again:

	bit = ffs(periph->periph_freetags[word]);

is compiled as

     15b0:	ea 00 20 48 	ffs $0x0,$0x20,0x50(r10)[r8],r9
     15b4:	aa 50 59
     15c0:	d6 58       	incl r8

which is obviously wrong, as r8 seems to be a byte index, but variable
"word" is an index into u_int32_t periph_freetags[].

The complete disassembly of an affected scsipi_base.o is here:

Swapping built-in ffs with a generic implementation successfully worked
around the problem.

It would be great if someone more familiar with gcc vax could have a
look and come up with a fix. Thanks!


Home | Main Index | Thread Index | Old Index