From: Martin DOT Stromberg AT lu DOT erisoft DOT se (Martin Stromberg) Newsgroups: comp.os.msdos.djgpp Subject: Re: Allocating vars in middle of function (possible DJGPP bug) Date: 7 Jul 1998 09:21:54 GMT Organization: Ericsson Erisoft AB, Sweden Lines: 37 Message-ID: <6nspbi$ai5$1@antares.lu.erisoft.se> References: <35A23721 DOT FAB AT interlog DOT com> NNTP-Posting-Host: spica.lu.erisoft.se To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Jedediah Smith (jedediah AT interlog DOT com) wrote: : In the middle of a function I had something like this: : : MyFunction() : { : ... : : { : char myString[20]; : : // myString is used only in here : : } : : ... : } : : My intention was to have myString allocated at the beginning of the code : block and deallocated at the end. Clearly myString was not getting : allocated at all because I was getting protection faults in the code : that used it. When I moved the myString declaration to the beginning of : the function, it worked fine. Should myString have been allocated in the : above example, or do I have my C++ syntax wrong? I don't know much about C++, but as the above look like C, let me answer. Yes, myString is allocated. Look in the assembler file generated with -S option to see that. This behaviour (crashing) can be caused by a run-away pointer. You can get similar results (crashing ceases) by moving around some code in your source. If you still thinks it's an error in GCC then post some code that exhibits this behaviour. Silence, MartinS