From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17568 invoked by alias); 4 Apr 2005 19:28:51 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 17539 invoked from network); 4 Apr 2005 19:28:44 -0000 Received: from unknown (HELO romy.inter.net.il) (192.114.186.66) by sourceware.org with SMTP; 4 Apr 2005 19:28:44 -0000 Received: from zaretski (IGLD-80-230-67-97.inter.net.il [80.230.67.97]) by romy.inter.net.il (MOS 3.5.6-GR) with ESMTP id AXE33467 (AUTH halo1); Mon, 4 Apr 2005 22:26:54 +0300 (IDT) Date: Mon, 04 Apr 2005 19:28:00 -0000 From: "Eli Zaretskii" To: Daniel THOMPSON Message-ID: <01c5394b$Blat.v2.4$d4951e40@zahav.net.il> Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=ISO-8859-1 CC: drow@false.org, gdb@sources.redhat.com, Reiner.Steib@gmx.de In-reply-to: <4250F37B.8090707@st.com> (message from Daniel THOMPSON on Mon, 04 Apr 2005 08:57:47 +0100) Subject: Re: Variable "foo" is not available Reply-to: Eli Zaretskii References: <20050401171947.GA19058@nevyn.them.org> <01c53768$Blat.v2.4$d52008a0@zahav.net.il> <20050402142639.GA27550@nevyn.them.org> <01c537af$Blat.v2.4$c36667c0@zahav.net.il> <20050402184023.GA20247@nevyn.them.org> <01c537c6$Blat.v2.4$427763a0@zahav.net.il> <20050402210541.GA16758@nevyn.them.org> <01c538d4$Blat.v2.4$b261c020@zahav.net.il> <4250F37B.8090707@st.com> X-SW-Source: 2005-04/txt/msg00033.txt.bz2 > Date: Mon, 04 Apr 2005 08:57:47 +0100 > From: Daniel THOMPSON > Cc: Daniel Jacobowitz , gdb@sources.redhat.com, > Reiner.Steib@gmx.de > > >>With stack-based argument passing, GCC may be claiming an argument is > >>unavailable when the function's local copy is dead, when a copy still > >>exists on the stack somewhere. I don't know if it will do that or not. > >>GDB can not assume that the argument is available in the incoming stack > >>slot, since it could be reused for other data. > > > > > > What, if any, would be the expression of this in the machine code? > > > > Also, I don't quite understand how can a stack slot of a function call > > argument be reused before the function returns. Isn't that slot > > outside the function's frame? Reusing it would be a violation of the > > ABI, right? > > I doubt it. > > The following C is perfectly valid. > > void foo(int a, int b, int c, int d) > { > a = b + c; > printf("a+d = %d\n", a, d); > printf("b = %d\n", b); > } > > On modern architectures with a decent number of registers (including > IIRC the x86-64) a, b and c will be passed in registers rather than on > the stack. Please note that, as should be clear from the citations above, my question was about reusing a stack slot under a stack-based argument passing scheme, not about passing arguments in registers.