bug in cc optimizer

Archie Lachner archiel at hercules.UUCP
Fri Sep 28 03:43:40 AEST 1984

There in a bug in the way the 4.2bsd C compiler treats bit fields under some
circumstances when optimization is turned on.  If there is a bit field 16 bits
long that falls on a byte boundary, the optimizer issues a "cvtwl," "movwl,"
or "movzwl" instruction instead of an "extv" or "extzv" instruction when
extracting the field, since the former are more efficient than the latter.
However, the address used for the field in any of the former is incorrect.

I have short program that documents this bug, if anyone is interested.
I don't know if this bug is present on other versions of UNIX, since I only
have 4.2 available to me.

				Archie Lachner
				Logic Design Systems Division
				Tektronix, Inc.

uucp:    {ucbvax,decvax,pur-ee,cbosg,ihnss}!tektronix!teklds!archiel
CSnet:   archiel at tek
ARPAnet: archiel.tek at csnet-relay

More information about the Comp.lang.c mailing list