delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2004/07/22/17:32:31

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
Message-ID: <20040722210443.17800.qmail@web50704.mail.yahoo.com>
Date: Thu, 22 Jul 2004 14:04:43 -0700 (PDT)
From: Lets Go Canes <letsgonhlcanes AT yahoo DOT com>
Subject: Re: strange error
To: djgpp AT delorie DOT com
In-Reply-To: <20040721091933.06719.00001806@mb-m13.aol.com>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

Hi all.

--- Sterten <sterten AT aol DOT com> wrote:

> my previous assumption concerning 
>  program size as the reason is also doubtful,
> since it could change from "running" to "error" when I just
> only change one (nonimportant) variable name from "p" to "o" ...
> And it only crashes after all solutions are found.

If it is crashing when your main function returns/exits, it is likely
that you are corrupting the stack.  When you use "-g", you are
including additional information in the binary, and this changes where
bits-and-pieces of your program and your data are located in memory. 
If this prevents a crash, it means that you are overwriting memory that
you didn't intend to - without "-g" you are overwriting something
(maybe stack space) that causes the crash, whereas with "-g" you are
getting lucky, and overwriting debug info instead.

You might try adding bounds-checking to your array indices.  I know in
the past I've had problems like this "that couldn't possibly be a bug
on my part", and after adding printf's to see what my indices were,
found bogus indices (like array[-1]), that were indeed caused by a bug
on my part.



=====
--------------
Lets Go Canes!


	
		
__________________________________
Do you Yahoo!?
Vote for the stars of Yahoo!'s next ad campaign!
http://advision.webevents.yahoo.com/yahoo/votelifeengine/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019