On Mon, Jun 11, 2012 at 04:19:16PM +0530, Satya Prakash Prasad wrote:
> >BTW, you might even use MELT (a high-level domain specific language to 
> >extend GCC) for that purpose.
> > See http://gcc-melt.org/ for more (or ask me).
> 
> Since our org is still making use of gcc 4.1.2 - hence the concern.

But since 4.1 is very ancient (and much less powerful than current 4.7 or 
recent 4.6), 
you'll have big trouble getting help on GCC 4.1... 
I believe that making the internal lobbying to switch to 4.7 -or perhaps 4.6- 
is *really* worth the effort.
Besides, 4.7 brings you a lot of features that 4.1 don't have (e.g. better 
recent language standard support, in particular C++2011, and link time 
optimization). In general, a lot of progress has been made on GCC since 4.1
Sticking to 4.1 will be painful to you, because you won't be able to get much 
help, 
and because that version is not supported any more.
Upgrading to GCC 4.7 (or 4.6 at least) is really worth the effort, even if that 
means a lot 
of internal lobbying inside your organization (and with your customers).


> Please let me know on usage of MELT.

It is a [meta-] plugin for GCC 4.6 & 4.7 providing you a lisp-like domain 
specific language to extend GCC. 
There are some slides & documentation (and also source code) 
on http://gcc-melt.org/ and you should subscribe to gcc-m...@googlegroups.com 
to get help on MELT. Of course, feel free to ask me questions about it!

> 
> Thanks but checking for cfun is NULL also does not helps me out I get
> the same issue:
> 
>   /* traverse each basic block and print all statements  */


Add
    gcc_assert (cfun != NULL);
before the FOR_EACH_BB loop, not inside it! Look into expansion og FOR_EACH_BB 
inside gcc/basic_block.h to understand why.

>   FOR_EACH_BB (bb){ /* in any order */
>   if(cfun == NULL)
>         return;
> 
>     bbcounter++;
>     printf("\n-> entering bb # %d (internal #: %d)\n", bbcounter, bb->index);
> 
>     stmtcounter=0;
> 
>     for(si = bsi_start(bb); !bsi_end_p(si); bsi_next(&si)){
>       stmtcounter++;
>       printf("   encountering statement #%2d: ", stmtcounter);
>       stmt = bsi_stmt(si);
>       print_generic_stmt (stderr, stmt, 0);
>     }
>   }
> 
> 
> gcc/gcc-4.1.2/host-x86_64-unknown-linux-gnu/gcc/xgcc
> -B/x/home/satprasad/shared_scripts/bin/gcc/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

Use also the gdb debugger on cc1 to understand what is happening exactly. 

But really, upgrade to GCC 4.7. 
(I believe you are losing your time if staying with GCC 4.1 
and not knowing it very well yourself; don't hope to get much help on GCC 4.1, 
since the GCC community forgot its details, and GCC has tremendously evolved 
since.).


Good luck. Cheers.
-- 
Basile STARYNKEVITCH         http://starynkevitch.net/Basile/
email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
8, rue de la Faiencerie, 92340 Bourg La Reine, France
*** opinions {are only mines, sont seulement les miennes} ***

Reply via email to