From: Mark Hull-Richter Subject: Found it! (was Odd behavior...) To: djgpp AT sun DOT soe DOT clarkson DOT edu (DJGPP Mailing List) Date: Fri, 3 Mar 1995 11:26:37 -0800 (PST) First of all, thanks to everyone who responded. Your pointers led me in the right direction, and with some minor tinkering of my debug switches, I managed to isolate the problem within about ten minutes last night. Re the Borland compilers: while I appreciate the comments about them I'm not really interested in pursuing that area at all. I've never been really happy with either of their C/C++ development systems and I'm just as glad to be rid of them. Besides, the upgrades are WAY too expensive to keep up with and the ROI is no longer worth it (especially not with DJGPP being free! :-). What was the bug? Oh, that. I was deleting entries from a local array. In one place I did it right, in the other I moved WAY too many bytes (whole array size instead of size of pieces that actually needed to be moved). In Unix this didn't cause any problems (that I could see), probably because memory allocation is done differently in SunOS C. There, I believe that the compiler allocates all "small" local arrays at the end of the frame, so overruns on the last or only one are harmless (they just go up the stack into unused territory as long as you don't call another function). Under MS-DOS, local arrays are allocated using another method, which caused the overrun to overwrite the base (i.e., frame) pointer (%ebp), which causes problems as you might imagine, like program aborts! :-) (It might also have to do with the direction of stack growth and the machine byte sex, but now I'm waxing esoteric and getting out of my depth, so forget it, please.) Thanks again. Hope someone can benefit from this besides just me. -- ++== AT&T Mark A. Hull-Richter, Consulting Engineer (310)524-5782 voice +GIS== Global Teradata Decision Enabling Systems Center 427-5782 VoicePlus =++=== Information 100 North Sepulveda Boulevard, #17-259 (310)524-5517 FAX ==== Solutions El Segundo, CA 90245 mhr AT sparc DOT SanDiegoCA DOT ATTGIS DOT com