Xref: utzoo comp.lang.c:19833 alt.msdos.programmer:190 Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!wasatch!wasatch.utah.edu!u-tholly From: u-tholly@wasatch.utah.edu (Troy Holly) Newsgroups: comp.lang.c,alt.msdos.programmer Subject: Help! (Problems with the stack?) Keywords: stack Message-ID: <2163@wasatch.utah.edu> Date: 11 Jul 89 10:22:58 GMT Sender: u-tholly@wasatch.utah.edu Distribution: usa Organization: University of Utah CS Dept Lines: 25 Have you ever had a piece of code that looses track of the stack? I thought this kind of thing only happened in Fortran. Here is the scoop. I am coding in Microsoft C 5.1, and am using the CodeView debugger. I have a line of code that passes arguments to the tanh() math function, but when I get there, all of the variables in the calling routine become undefined, and I get an "M6101 invalid" floating point error. This particular line of code is executed many times before (it is in a loop) with no problems. Using the debugger, I have traced every step of the execution, and the variables in the calling routine are just fine. As soon as execution is passed to tanh() they become undefined; however, after examining thier memory locations, they are still intact. Just before the call to the tanh() function, I call memaval() and stackavail(), and there are 52k and 1k bytes free respectively. At first I thought maybe the problem was a memory allocation error, but the heap is a long ways from the stack and data segments, according to the debugger. My best guess is that the location of the variables in the calling routine are getting lost in the stack. Your best guess has got to be better than mine, so help me out if you can. Thanks in advance, Troy -