From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2888 invoked by alias); 24 Feb 2003 21:46:01 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 2866 invoked by uid 71); 24 Feb 2003 21:46:00 -0000 Resent-Date: 24 Feb 2003 21:46:00 -0000 Resent-Message-ID: <20030224214600.2865.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, luke@diamand.org Received: (qmail 2617 invoked by uid 48); 24 Feb 2003 21:45:43 -0000 Message-Id: <20030224214543.2616.qmail@sources.redhat.com> Date: Mon, 24 Feb 2003 21:46:00 -0000 From: luke@diamand.org Reply-To: luke@diamand.org To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version: gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: target/9841: ARM - appears to always save LR on stack, even with -fomit-frame-pointer X-SW-Source: 2003-02/txt/msg01294.txt.bz2 List-Id: >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: