Mail Archives: djgpp/2004/07/22/17:32:31
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 -