This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

unneeded stuff when call


Hello,

I have a source:

  long var_x;

  void func()
  {
       var_x = 55;
  }

compile it (-S -O2 -fomit-frame-pointer file.c), and get

_func:
  movl $55, _var_x
  ret

---------------------------------------------------------
after I append some lines:

  long var_x;
  typedef void (*functype)();

  void func()
  {
       var_x = 55;
       ((functype)var_x)();
  }

compile it (-S -O2 -fomit-frame-pointer file.c), and get

_func:
  subl  $12, %esp         (1)
  movl  $55, %eax
  movl  $55, _var_x
  call  *%eax
  addl  $12, %esp         (1)
  ret

WHY compiler add lines (1)? It don't needed there!
Can compiler don't generate this lines?
  
gcc -v
gcc version 3.2.3 (mingw special 20030504-1)

-- 
Best regards,
 RomikB                          mailto:romikb@mail.ru


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]