Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!maverick.ksu.ksu.edu!hoss!vlsiws!price From: price@vlsiws.unl.edu (Chad Price) Newsgroups: comp.lang.c Subject: Re: Turbo C program inconsistent runtime problems Message-ID: Date: 24 Aug 90 21:15:00 GMT References: <19962@orstcs.CS.ORST.EDU> Sender: news@hoss.unl.edu (Network News Administer) Organization: University of Nebraska, Computing Resource Center Lines: 36 In <19962@orstcs.CS.ORST.EDU> duvalj@bionette.cgrb.orst.edu (Joe Duval - Entomology) writes: >The last thing I did was to add some function prototypes and move some >functions around to better organize the program. This did involve splitting >up one file into two. The program was behaving OK before these changes, but >not perfectly and is certainly worse than before. <:-) >I would like to get some suggestions on where to start looking for the >problems. I haven't been able to pinpoint it to a specific point in the >There are probably some pointers out there that don't get malloc'd correctly >or start pointing to other things maybe. This is a fairly large program and >I would like to jump into debugging it with some direction. From your description, there are a lot of places to look, but it would seem likely that you are experienceing either stack corruption or are writing over video or other memory (probably including DOS's memory space) As a place to start, I would compile the source with ALL of the Turbo warnings turned on, and fix ALL of the warnings: remove all unused variables, ensure that all pointers are properly initialized, check the return values on all library and system calls that provide them. Then, if you still have problems, start with the debugger, stepping through the program 1 line at a time, checking relevant variable values and memory locations as you go. I had a similar problem some time ago with code I was porting from FORTRAN to C and was eventually able to make the problem go away, but I don't remember what eventually fixed it. IMO, the best approach is a systematic approach: tackle one problem at a time and fix it before going on. Good luck, as the process may be long. Chad Price price@fergvax.unl.edu