Hi Lalit,
What OS are you using?
What version of GCC are you using?
Can you isolate the problem...
1. Could you break up the translation unit to separate files, such that there is merely one routine per source file?
2. And make sure that the header files which are included are minimal?
3. Create a standalone source file -- a "toy routine" -- that exhibits the bad behavior?
4. Submit that compilable (with no optimizer flags) / non-compilable (with optimizer flag) toy routine to this forum?
5. Specify all the compiler flags you utilize.
6. Provide the result of "gcc -v" or "g++ -v".
Thanks, --Eljay