From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13250 invoked by alias); 29 Apr 2014 07:12:58 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 13225 invoked by uid 48); 29 Apr 2014 07:12:54 -0000 From: "meisenmann.lba@fh-salzburg.ac.at" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/60996] New: Bad code (I.e. needless insns) with option momit-leaf-frame-pointer; side-effect on non-leaf functions Date: Tue, 29 Apr 2014 07:12:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 4.8.2 X-Bugzilla-Keywords: X-Bugzilla-Severity: minor X-Bugzilla-Who: meisenmann.lba@fh-salzburg.ac.at X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-04/txt/msg02114.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60996 Bug ID: 60996 Summary: Bad code (I.e. needless insns) with option momit-leaf-frame-pointer; side-effect on non-leaf functions Product: gcc Version: 4.8.2 Status: UNCONFIRMED Severity: minor Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: meisenmann.lba@fh-salzburg.ac.at Using the option '-momit-leaf-frame-pointer' (with -fno-omit-frame-pointer) has a side-effect on non-leaf functions. The code-snippets afterwards (produced with an i386-elf cross-compiler for an IA32-target) will show the difference: A) Without the option momit-leaf-frame-pointer: Example1: pushl %ebp movl %esp, %ebp pushl %ebx subl $8, %esp movl (%eax), %ebx pushl 12(%ebp) pushl 8(%ebp) pushl %ecx pushl %edx pushl %eax call *12(%ebx) movl -4(%ebp), %ebx leave ret B) Option '-momit-leaf-frame-pointer' used: Example1: pushl %ebp movl %esp, %ebp pushl %ebx subl $8, %esp movl (%eax), %ebx pushl 12(%ebp) pushl 8(%ebp) pushl %ecx pushl %edx pushl %eax call *12(%ebx) addl $24, %esp movl -4(%ebp), %ebx leave ret In this case there'a an additional stack-adjustment (addl $24, %esp) before the "final" stack-leave instruction. Some other examples with less forwarded call-arguments have shown a few pop-insn instead of an 'add'. These additional instruction(s) directly before reverting the stack-frame has no functional effect, but will consume a few CPU-cycles.