mdh said:
I think another poster mentioned that a return from a void function is
undefined. I do not know enough exactly to know the implication of
this, but I wonder if this has something to do with it?
No, a return from a void function isn't undefined.
A return statement that returns a value is illegal in a function
declared to return void. I presume that's not your problem; if it
were, your program wouldn't have compiled.
A return statement *without* an expression in a function that returns
a type other than void is legal in C90, but illegal in C99. It's a
bad idea in any case. At best, it's going to return garbage to the
caller, which will presumbably be expecting something sensible.
Falling off the end of a function (i.e., reaching the closing "}"
without executing a return) is ok if the function returns void, and a
bad idea otherwise. For a non-void function, this will also return a
garbage value to the caller; the caller's attempt to use the result
invokes undefined behavior.
I wasn't able to find the code in question, so I don't know whether
any of this applies to your program. If it does, fix it; there's not
much point in doing anything else until you've fixed any known bugs.
(That's not *always* true; there are times when you can be sure that a
given bug isn't the cause of the misbehavior you're seeing. But such
assumptions can easily be wrong.)