From: utzoo!decvax!harpo!floyd!vax135!ariel!hou5f!npoiv!alice!mhtsa!eagle!mit-vax!mp
Newsgroups: net.unix-wizards
Title: 4.1bsd pcc bug
Article-I.D.: mit-vax.207
Posted: Mon Feb 21 16:17:45 1983
Received: Wed Feb 23 05:44:20 1983

The following bug in the 4.1bsd pcc compiler was passed on to me by
Jeff Mogul of Stanford.  The compiler seems to forget that a cvtfd
instruction clobbers 2 registers, rather than 1.  Several of us here
with a less-than-complete understanding of pcc fooled with the
templates in table.c, but didn't get anywhere.

#include	

double	dd[] =	{ 0.0, 2.0 };
float	ff[] =	{ 0.0, 1.0 };
int i = 1;

main(){
	if( ff[i] >= dd[i] ) printf( "ff >= dd\n" );
}

Here is the buggy Vax machine code (cc -S, no optimizer):

	movl	_i,r0
	movl	_i,r1
	cvtfd	_ff[r0],r0
	cmpd	r0,_dd[r1]
	jlss	L25