Help! (Problems with the stack?)

Troy Holly u-tholly at wasatch.utah.edu
Tue Jul 11 20:22:58 AEST 1989


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 -



More information about the Comp.lang.c mailing list