[gnu.gcc.bug] take 2 on mysterious bug

benson@HARVARD.HARVARD.EDU (Benson I. Margulies Kendall Square Research Corp.) (03/18/89)

I believe that I have a nearer shot at my previous useless bug report.

I have a very large switch statement.  I can't easily send you the
source.	I can send you the machine code that I think is going wrong.

The switch gets compiled as a computed goto. The sun compiler goes to
the right place, gcc 1.34 -g goes to the wrong case I believe 0),
every time. I can't read SPARC code for shit, or I could really
diagnose this.

unsigned long x = 0x320ec1ec;
switch ((((x) & 0xc) >> 2) | (((x) & 0x3f000000) >> 22)) {

case ...:

}


Sun cc code:

	set	0x3f000000,%l7
	and	%i0,%l7,%i1
	srl	%i1,0x16,%i2
	and	%i0,0xc,%o0
	srl	%o0,0x2,%o0
	or	%o0,%i2,%o0
	cmp	%o0,239
	bgu	L1109
	sll	%o0,2,%o0
	set	L2000081,%o1
	ld	[%o0+%o1],%o0
	jmp	%o0
	nop

gnu cc code:

LM3:
	and %o0,12,%o0
	srl %o0,2,%o0
	sethi %hi(1056964608),%g1
	or %lo(1056964608),%g1,%g1
	and %o0,%g1,%o1
	srl %o1,22,%o1
	or %o0,%o1,%o0
	add %o0,0,%o0
	cmp %o0,239
	bgu L895
	nop
	sethi %hi(L2715),%o1
	or %lo(L2715),%o1,%o1
	sll %o0,2,%o0
	ld [%o1+%o0],%o0
	jmp %o0
	nop