public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* target/9841: ARM - appears to always save LR on stack, even with -fomit-frame-pointer
@ 2003-02-24 21:46 luke
  0 siblings, 0 replies; 2+ messages in thread
From: luke @ 2003-02-24 21:46 UTC (permalink / raw)
  To: gcc-gnats


>Number:         9841
>Category:       target
>Synopsis:       ARM - appears to always save LR on stack, even with -fomit-frame-pointer
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Feb 24 21:46:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     luke@diamand.org
>Release:        3.2.2
>Organization:
>Environment:
Linux x86 host
arm-elf target
>Description:
ARM/gcc3.2.2 always appears to save LR on the stack, even when not needed, and regarldess of -fomit-frame-pointer.

>How-To-Repeat:

I seem unable to get -fomit-frame-pointer to do anything on
ARM/gcc3.2.2.

With gcc2.95.2, configured for ARM/AOUT, compiling the following function:

void test(char *buf) {
    my_strcpy(buf,"HELLO");
}

with:
% gcc -S -O2 -fomit-frame-pointer -mapcs-32 foo.c

I would get:

_test:
        @ args = 0, pretend = 0, frame = 0
        @ frame_needed = 0, current_function_anonymous_args = 0
        @ I don't think this function clobbers lr
        ldr     r1, L3
        b       _my_strcpy

Now the same code, with gcc3.2.2 (configured for ELF this time but I can't see why that should change things) I get:

test:
        @ args = 0, pretend = 0, frame = 0
        @ frame_needed = 0, uses_anonymous_args = 0
        str     lr, [sp, #-4]!
        ldr     r1, .L2
        @ Sibcall epilogue
        ldr     lr, [sp], #4
        b       my_strcpy

So, the compiler carefully stores lr on the stack, for no good reason as far as I can tell (I have no interest in debugging this code, hence the -fomit-frame-pointer). I can't find any combination of options that will make this compile properly (-mapcs-frame, -mapcs-32).

Looking at the code in gcc/config/arm/arm.c, and comparing releases, it looks as though the code for this optimization has been lost.

This adds quite significantly to code size, and probably slows things down as well.
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


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

* Re: target/9841: ARM - appears to always save LR on stack, even with -fomit-frame-pointer
@ 2003-02-26 17:56 rearnsha
  0 siblings, 0 replies; 2+ messages in thread
From: rearnsha @ 2003-02-26 17:56 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, luke, nobody

Synopsis: ARM - appears to always save LR on stack, even with -fomit-frame-pointer

State-Changed-From-To: open->closed
State-Changed-By: rearnsha
State-Changed-When: Wed Feb 26 17:56:57 2003
State-Changed-Why:
    Already fixed in 3.3 and on the trunk

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9841


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

end of thread, other threads:[~2003-02-26 17:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-24 21:46 target/9841: ARM - appears to always save LR on stack, even with -fomit-frame-pointer luke
2003-02-26 17:56 rearnsha

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).