This is the mail archive of the gcc-bugs@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]

[Bug target/18759] New: [x86] using both -fomit-frame-pointer and -momit-leaf-frame-pointer enables frame pointers for non-leaf functions


Using both -fomit-frame-pointer and -momit-leaf-frame-pointer _enables_ frame
pointers for non-leaf functions.
 
> cat x.c
int foo(void) { return 0; }
int bar(void) { return foo() + 1; }

> gcc-3.4 -O2 -fomit-frame-pointer -c x.c && objdump -d x.o

  [...]
00000010 <bar>:
  10:   e8 fc ff ff ff          call   11 <bar+0x1>
  15:   40                      inc    %eax
  16:   c3                      ret
  [...]

> gcc-3.4 -O2 -fomit-frame-pointer -momit-leaf-frame-pointer -c x.c && objdump
-d x.o

  [...]
00000010 <bar>:
  10:   55                      push   %ebp
  11:   89 e5                   mov    %esp,%ebp
  13:   e8 fc ff ff ff          call   14 <bar+0x4>
  18:   5d                      pop    %ebp
  19:   40                      inc    %eax
  1a:   c3                      ret
  [...]



This check in i386.c ix86_frame_pointer_required() could be the cause:

  /* In override_options, TARGET_OMIT_LEAF_FRAME_POINTER turns off
     the frame pointer by default.  Turn it back on now if we've not
     got a leaf function.  */
  if (TARGET_OMIT_LEAF_FRAME_POINTER
      && (!current_function_is_leaf))
    return 1;

-- 
           Summary: [x86] using both -fomit-frame-pointer and -momit-leaf-
                    frame-pointer enables frame pointers for non-leaf
                    functions
           Product: gcc
           Version: 3.4.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: markus at oberhumer dot com
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: i386-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18759


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