[net.unix-wizard] c2

dmy (12/15/82)

/*
   The following program contains, as one line, the smallest version of a
   c-optimizer bug that I could construct.  I looked at the erroneous assembler
   code produced by the optimizer, and this is definitely a compiler problem.
   Anyone know of this bug before?

   On our 4.1absd, running a.out after cc -O test.c produces 840.
   After cc test.c, it produces the correct value of 50.

   The bug (in the optimized object code) is a missing cvtdl (I believe).
*/

main()
{
float f;
int n;
	f = 50.0;
	n = (int)f & 07777;	/* this statement is the bug */
	printf("%d\n",n);
}


/*

--dmy--

*/