Date: Fri, 13 Sep 1996 16:50:55 -0700 (PDT) From: Samuel Vincent To: Thomas Nilsson cc: djgpp AT delorie DOT com Subject: Re: Possible static data zeroisation bug in DJGPP v2? In-Reply-To: <3239989F.4626@softlab.se> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII On Fri, 13 Sep 1996, Thomas Nilsson wrote: > I have an application which I mainly develop on Unix, however thanks to > the wonderful DJGPP it's very easy to port to PC's, thanks all who have > contributed in the DJGPP project!! > > However I have stumbled upon a problem: > > In one of the modules I have a static structure that is essential to the > output from the program. Somehow it is not zeroised correctly, or of > course it could be overwritten by some other part of the program. I > decided to investigate and started 'gdb' a debugger which I am much > familiar with from the Unix environment. > > IT WON'T LET ME SEE THE STRUCTURE UNTIL I ENTER A FUNCTION WHICH USES > IT. > > The structure is declared static at the top level of the module and in > the beginning of the file, but still gdb says 'No symbol xxxx in current > context'. The structure *should* not be used before that point in the > running of the program, but it is not zero as I would have expected. > > This being strange, but still I wanted to investigate this structure, so > I removed the static declaration to make it more visible, and thought > that I might get at it already at the start of the program. And of > course I could, *but* now it is zeroised correctly and not destroyed so > the program works perfectly... > > Is this a bug, or if not, how do I find out when the structure is > trashed. Note however that Purify (a lovely memory access analyser for > many plattforms) does not indicate any problems on Unix (so at least > it's not a general bug, but then which ones are...) rather than just doing a: static struct whatever mystruct; since you want it zeroed, you are doing this, correct? static struct whatever mystruct = { 0 }; -Sam