sharathyd wrote: > I'm not able to give that program because its huge. But i'm sure its > failing at this point. I'm also trying to recreate this problem by small > program but I couldn't! Here is some test cases... > > Compiled ---- > With debug flag (ie in debug mode) == its working > without debug flag and not initialization to NULL == its working > without debug flag and initialization to NULL == its not working. > > I'm suspecting some runtime environment issue or optimization problem , Is > there gcc flag to suppress this!? To suppress optimization don't use -O. I suspect you're corrupting memory somewhere else in your program, but i can't know that for sure. A gdb watchpoint on retrivalFunc might help. I presume your example code was no complete, and that you return something if attRetrivalfunc == NULL. Andrew.