D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] gnu compiler experts anywhere?

 

On 03/11/10 12:38, tom wrote:

I should have added that compiling for debugging makes the damn thing
work.

Using an uninitialised variable is often favourite for this.  I can't
recall if it happens for dynamic or statically variables or both, but
my recollection is that when compiling for debug, some storage can get
initialised to zeros that wouldn't otherwise be, allowing code that
normally gets a random value for some variable to work because in
debug mode it ends up with a "sane" value of zero.  If the variable is
used for an array index, for instance, then myarray[0] is pretty much
guaranteed not to fall over, whereas myarray[23142768643532] is likely
to throw a seg fault.

James

--
The Mailing List for the Devon & Cornwall LUG
http://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/listfaq