Date: Wed, 9 Dec 92 11:00:59 CST From: csaba AT vuse DOT vanderbilt DOT edu (Csaba A. Biegl) To: djgpp AT sun DOT soe DOT clarkson DOT edu Subject: Re: on -O and -O2, again >> >> (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?) I compiled the original (integer variables not 'static') program without optimization, with -O and with -O2. I ran the executables on five different systems: 386/33 8MB RAM 486/66DX2 8MB RAM 386/20 4MB (32bit) + 2.5MB (16bit) RAM 486/33 16MB RAM 386SX/25 2MB RAM I used DJGPP 1.09. Out of the five systems four executed all three versions of the program without error. The fifth system, the 486/33 with 16Megs, died when running the -O2 compiled program with Exception 14. It executed the other two programs without error. Conclusion: Hardware error on some motherboards??? Csaba Biegl csaba AT vuse DOT vanderbilt DOT edu