The frame pointer is removed by the following options:

-Os -fomit-frame-pointer
        

The frame pointer can be removed in most cases. However, in some cases the compiler cannot remove it (this behavior is common to all processors supported by gcc).

In the following example:

int get(int size)
{
  int table[size];

bar (table, size); return table[0]; }

the size of the array 'table' is not known at compile time but at run time. The table is allocated on the stack. Since it is necessary to restore the stack before the return, the frame pointer is kept and used for that.