From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26538 invoked by alias); 29 May 2010 14:45:56 -0000 Received: (qmail 24625 invoked by uid 48); 29 May 2010 14:45:35 -0000 Date: Sat, 29 May 2010 14:45:00 -0000 Message-ID: <20100529144535.24623.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug target/44290] [4.5 Regression] __naked attribute is broken In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "rguenth at gcc dot gnu dot org" 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/msg03214.txt.bz2 ------- Comment #15 from rguenth at gcc dot gnu dot org 2010-05-29 14:45 ------- (In reply to comment #13) > (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. Then the target has to properly communicate this to the middle-end. > 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. I'd have required dummy inputs like "g" (kto), "g" (kfrom) not used by the actual assembly. For now re-open as a target bug. -- rguenth at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED Resolution|INVALID | Summary|[4.5 Regression] arm linux |[4.5 Regression] __naked |kernel crahes when built |attribute is broken |with -fipa-sra, __naked | |attribute is broken | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44290