>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.
Please let me know on usgae of MELT.

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  */

  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
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



On Mon, Jun 11, 2012 at 4:03 PM, Basile Starynkevitch
<bas...@starynkevitch.net> wrote:
> On Mon, Jun 11, 2012 at 03:41:16PM +0530, Satya Prakash Prasad wrote:
>> I am trying to write a new GCC pass in gcc-4.1.2. This is my first
>> attempt and I am trying to print lines of code for a function gcc is
>> compiling. So I added the below code. Note if I remove code in
>> execute_gimple_manipulation method the issue does not occur :
>>
>> gcc/gcc-4.1.2 1223> cat gcc/gimple-manipulation.c
> [...]
>> Any help ? why the issue is occurring and how can I achieve the objective?
>
> GCC 4.1 is a very old version of the compiler [most of us forgot the details 
> of it]
> I strongly suggest to upgrade to a recent version (e.g. 4.7 or at least 4.6).
>
> You should test that cfun is non-null.
>
> And recent versions may accept plugins, which is a nice and easy way to 
> experiment addition of new passes in GCC.
>
> 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).
>
> 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