C Compiler bug (a mutant strain)

Hugh Redelmeier hugh at hcrvx1.UUCP
Fri Jul 25 01:34:25 AEST 1986


In article <6224 at allegra.UUCP> mp at allegra.UUCP (Mark Plotnick) writes:
>The i /= f and i *= f bugs occur in the 4.3bsd-beta and 4.2bsd
>compilers...  The 4.3bsd and System V VAX compilers do the right thing.

Well, not so fast.  Many System V compilers (I don't know about
4.3BSD -- we haven't gotten it yet!) have a bug in the fix to this
bug!  Try "*p++ /= f;" where p is "int *": the ++ gets done twice.
In fact, any side-effect on the left-hand-side would be done twice.
Allen McIntosh of HCR has fixed this (with some effort) as part of our
optimizer project (we produce a portable optimizer that fits into PCC
and f77).

Hugh Redelmeier (416) 922-1937
{utzoo, ihnp4, decvax}!hcr!hugh



More information about the Comp.lang.c mailing list