From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16691 invoked by alias); 29 May 2010 14:27:39 -0000 Received: (qmail 16633 invoked by uid 48); 29 May 2010 14:27:27 -0000 Date: Sat, 29 May 2010 14:27:00 -0000 Message-ID: <20100529142727.16632.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug target/44290] [4.5 Regression] arm linux kernel crahes when built with -fipa-sra, __naked attribute is broken In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "mikpe at it dot uu dot se" 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 X-SW-Source: 2010-05/txt/msg03211.txt.bz2 ------- Comment #13 from mikpe at it dot uu dot se 2010-05-29 14:27 ------- (In reply to comment #10) > Or rather, if you have > > void __attribute__((naked)) foo (int i) > { > asm("use i"); > } > > without any inputs refering to i that is invalid. Not according to gcc/doc/extend.texi: > @item naked > @cindex function without a prologue/epilogue code > Use this attribute on the ARM, AVR, IP2K, RX and SPU ports to indicate that > the specified function does not need prologue/epilogue sequences generated by > the compiler. It is up to the programmer to provide these sequences. The > only statements that can be safely included in naked functions are > @code{asm} statements that do not have operands. Note: "do not have operands". Thus the only way such an asm() can refer to parameters is by assuming a standard function call sequence and hardcoding corresponding register numbers or stack frame offsets. However, even if the asm() refers to those parameters via "r"(...) inputs, gcc-4.5 changes the register assignment to not agree with the standard call sequence, I'll attach a small test case showing that in a moment. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44290