Date: Wed, 9 Dec 92 08:45:56 CST From: "Jeremy Mathers" To: 9041477 AT sscvax DOT cis DOT mcmaster DOT ca Subject: Re: on -O and -O2 again Cc: djgpp AT sun DOT soe DOT clarkson DOT edu (Stuff deleted) >int argc; >char **argv; >{ matrix morg; > static int lact, lm, ln; > ^ > add this here > > for (lact=0; lact <= maxdim; ++lact) > { printf("lact=%5d ",lact); fflush(stdout); > for (lm=0; lm <= 2*lact; ++lm) > for (ln=0; ln <= 2*lact; ++ln) > morg[lm][ln] = 1.0; > } >} >/*-----------------------------------------------------------------------*/ >Add "static" in front of your declaration "int lact, lm, ln" solves >the problem. Does it solve it, or just make it go away? (I.e., is there a theoretical basis for this fix? I don't think so...) This problem seems somewhat similar to the one I posted some time ago, regarding local variables in nested functions. That one was a problem without -O or -O2, but went away when either was present. That one was generally conceded to be real and to be native to 386 based versions of GCC. (I.e., not unique to DJGPP. Has anyone tested this later version of the orig poster's program on GCC under a 386 Unix?)