if bug in Ritchie C compiler - (nf)

crl crl
Wed Jan 26 12:01:44 AEST 1983

pur-phy!crl    Jan 26 11:02:00 1983

I have just noticed a bug in the Ritchie C compiler (or at least
an example of it being too smart for its own good).  Consider the
		if (foo()*0);
		printf("in foo\n");

The compiler thinks:  "Well, foo() * 0 is always false, so I won't
even compile the if statement."

I don't think that this should be the way it compiles, what do you
people think?  (I know no sane person would do this, but I had to
fix some software I got from somewhere else where in a complicated
series of #ifdefs someone had decided that this was the easiest
way to have the if always fail.  YECCH!)

The "bug" does not seem to exist in our version of pcc.

Charles LaBrec

More information about the Comp.lang.c mailing list