Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!hplabs!hpda!hpcupt1!hpisod2!decot From: decot@hpisod2.HP.COM (Dave Decot) Newsgroups: comp.lang.c Subject: Re: Pcc bites it (was Re: programming puzzle (silly)) Message-ID: <2550086@hpisod2.HP.COM> Date: 14 Mar 89 20:34:26 GMT References: <28336@ucbvax.BERKELEY.EDU> Organization: Hewlett Packard, Cupertino Lines: 29 > Interesting -- the program *is* incorrect, because && has higher > precedence than *= so it is parsed as: > > (n&&m) *= n-- > > which is illegal because (n&&m) is not an lvalue. No it isn't. It doesn't have two different valid interpretations, so it's not ambiguous, so the precedence rules are not applicable. The only valid parsing of the expression is n && (m *= n--). > Our MetaWare and Green Hills compilers catch it, but every pcc-based > compiler I tried compiled it with no warnings. Your compilers are broken. > Looking at the assembly-language generated, it appears that it compiled as: > > n && (m*=n--) ...which is correct. > What do other compilers out there do? I hope they perform as above. I'm tired of compiler bugs. Dave