Thanks to all my issue got resolved. I placed the code in 'if block' checking cfun is NULL or not and removed gcc_assert. It worked fine for me.
My idea is to print the lines of source code gcc is compiling. Further to that I want to update the statement with statement ; print("%s %d\n", __FILE__, __LINE__); So that when program is running I know which file which line of my program is getting executed. I tried printing statements in pass_remove_useless_stmts pass but I think these are internal GCC stages. I see statements of code like: if (D.3886 > 0) { D.3887 = obj->funcs; D.3888 = D.3887->close; D.3886 = obj->next_input; D.3888 (obj, D.3886); } So please let me know how can I achieve the objective and which pass should I make use of? Regards, Prakash On Tue, Jun 12, 2012 at 11:06 AM, Ian Lance Taylor <i...@google.com> wrote: > Satya Prakash Prasad <satyaprakash.pra...@gmail.com> writes: > >> But the compilation process fails further on: >> >> gcc/gcc-4.1.2/host-x86_64-unknown-linux-gnu/gcc/xgcc >> -Bgcc/gcc-4.1.2/host-x86_64-unknown-linux-gnu/gcc/ >> -B/usr/local/x86_64-unknown-linux-gnu/bin/ >> -B/usr/local/x86_64-unknown-linux-gnu/lib/ -isystem >> /usr/local/x86_64-unknown-linux-gnu/include -isystem >> /usr/local/x86_64-unknown-linux-gnu/sys-include -O2 -O2 -g -O2 >> -DIN_GCC -W -Wall -Wwrite-strings -Wstrict-prototypes >> -Wmissing-prototypes -Wold-style-definition -isystem ./include -fPIC >> -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -msse -c >> \ >> ../.././gcc/config/i386/crtfastmath.c \ >> -o crtfastmath.o >> ../.././gcc/config/i386/crtfastmath.c:110: internal compiler error: >> Segmentation fault >> Please submit a full bug report, >> with preprocessed source if appropriate. >> See <URL:http://gcc.gnu.org/bugs.html> for instructions. >> make[2]: *** [crtfastmath.o] Error 1 >> make[2]: Leaving directory `gcc/gcc-4.1.2/host-x86_64-unknown-linux-gnu/gcc' >> make[1]: *** [all-gcc] Error 2 >> make[1]: Leaving directory `gcc/gcc-4.1.2' >> make: *** [all] Error 2 >> gcc/gcc-4.1.2 1223> >> >> Any help – why the issue is occurring and how can I achieve the objective? > > The straightforward approach will be to pull out the debugger and see > what is going on when the compiler crashes. It may help to look at > http://gcc.gnu.org/wiki/DebuggingGCC . > > Ian