unneeded stuff when call

RomikB romikb@mail.ru
Thu Jul 3 20:21:00 GMT 2003


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



More information about the Gcc-help mailing list