[gnu.gcc.bug] '386 gcc bug for 1.28

zeeff@b-tech.ann-arbor.mi.us (Jon Zeeff) (10/16/88)

The following code produces an invalid instruction:


static unsigned short
newh(pred, foll)		/* new hash function */
	unsigned short  pred;	/* code for preceeding string */
	unsigned char   foll;	/* value of following char */
{
	return (((pred + foll) & 0xFFFF) * 15073) & 0xFFF; /* faster hash */
}

newh:
	pushl %ebp
	movl %esp,%ebp
	pushl %ebx
	movw 8(%ebp),%dx
	movw %dx,8(%ebp)
	movb 12(%ebp),%dl
	movb %dl,12(%ebp)
	movzbw 12(%ebp),%bx
	addw 8(%ebp),%bx
	imulw $15073,%bx   <- error
	andw $4095,%bx
	movzwl %bx,%eax
	jmp .L79
.L79:
	leal -4(%ebp),%esp
	popl %ebx
	leave
	ret
	.align 4
-- 
Jon Zeeff      			Branch Technology,
umix!b-tech!zeeff  		zeeff@b-tech.ann-arbor.mi.us

james@bigtex.cactus.org (James Van Artsdalen) (10/19/88)

In <4871@b-tech.ann-arbor.mi.us>, zeeff@b-tech.ann-arbor.mi.us (Jon Zeeff) wrote:

> The following code produces an invalid instruction: [...]

> 	imulw $15073,%bx   <- error

I believe this is a valid 386 instruction.  I think the bug is in the
assembler.
-- 
James R. Van Artsdalen      james@bigtex.cactus.org      "Live Free or Die"
Home: 512-346-2444 Work: 338-8789       9505 Arboretum Blvd Austin TX 78759