public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/18759] New: [x86] using both -fomit-frame-pointer and -momit-leaf-frame-pointer enables frame pointers for non-leaf functions
@ 2004-12-01 16:46 markus at oberhumer dot com
  2004-12-01 23:03 ` [Bug target/18759] " giovannibajo at libero dot it
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: markus at oberhumer dot com @ 2004-12-01 16:46 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2005-05-03 21:54 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-01 16:46 [Bug target/18759] New: [x86] using both -fomit-frame-pointer and -momit-leaf-frame-pointer enables frame pointers for non-leaf functions markus at oberhumer dot com
2004-12-01 23:03 ` [Bug target/18759] " giovannibajo at libero dot it
2004-12-02 21:19 ` cvs-commit at gcc dot gnu dot org
2004-12-02 21:22 ` pinskia at gcc dot gnu dot org
2004-12-02 21:28 ` markus at oberhumer dot com
2005-05-03 21:04 ` jsm28 at gcc dot gnu dot org
2005-05-03 21:54 ` cvs-commit at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).