Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!gatech!tut.cis.ohio-state.edu!cs.utexas.edu!pp!milano!bigtex!rena!kogwy!ccut!titcca!anprda!qmfl!spee From: spee@qmfl.qmflp.JUNET (Paul SPEE) Newsgroups: gnu.gcc.bug Subject: bug in assignment containing side-effect Message-ID: <366@qmfl.qmflp.JUNET> Date: 11 Jul 89 05:36:53 GMT Reply-To: spee%qmflp.junet@RELAY.CS.NET (Paul SPEE) Organization: Quantum Magneto Flux Logic Project, Tsukiji, Tokyo Lines: 26 I was pointed out the following bug: #include char *string = "aBcDeF"; main() { char *p = string; printf("%s\n", string); while (*p) { *p++ = islower(*p) ? toupper(*p) : *p; } printf("%s\n", string); } SUN cc result: gcc v1.22 result: aBcDeF aBcDeF ABCDEF BCDEF The cause is that gcc evaluates the lhs first. Is this fixed in later version or is this ANSI behavior? Paul Spee - spee%qmflp.junet@RELAY.CS.NET