I have a code. like this:
int functionA (){
Foo(**,**,**);
return 0;
}
Foo() is a huge function(more than 10,000 lines). Which I don’t understand all.Foo function includes some multi-thread code.
The problem now is, if I have “return” code right after Foo, Foo can be run correctly.
If I insert some other code (even a really simple cout code) between Foo() and “return”. The Foo function will act weird(partly not run correctly).
I debugged this thing for 3 days. Nothing found.
Sounds like
Foois corrupting the stack in some way. You’ll probably find that declaring redundant variables (and hence changing the contents of the stack) “fixes” the problem.I’d look for a tool that finds memory problems in your code. If you don’t have such a tool, look really carefully at all the usages of allocated memory.