anandulle wrote:

> ************total no of increment count :: 0
> 
> 
> /home/ulle/gcc/native/cprog/pg1.c: In function ‘main’:
> /home/ulle/gcc/native/cprog/pg1.c:7: internal compiler error: Segmentation
> fault

  When you've been adding code to GCC and you see a seg fault crop up like
this, it usually means you've done something bad with a pointer.  (GCC has
internal handlers that intercept things like NULL dereferences and convert
them into the internal compiler error message you see above).

  You could run the compiler again using "-v" to see the command-line passed
to cc1, and then run that under gdb, setting a breakpoint on "internal_error",
and see where it gets called from.  But I can work it out just from seeing the
output and reading your code: it crashed just after you print the increment
count, so what happens after that?

  if(flag_pass_gccwk09){
     fprintf(dump_file,"\n\n************Number of assignment statements::
%d\n\n",numassigns);
     fprintf("\n\n************total no of init expr :: %d\n\n",varexpr);
     fprintf(dump_file,"\n\n************Total Number of assignment statements
(including temp vars):: %d\n\n",totalassigns);
  }

  Look at the middle fprintf: you forgot the 'dump_file' argument, so it's
trying to treat the format string as a FILE* pointer!  Argh!  (Are you
building with --disable-werror?  I would have expected this to cause a warning
and make the compiler build fail.)

    cheers,
      DaveK


Reply via email to