From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2388 invoked by alias); 28 Nov 2002 10:41:21 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 2143 invoked from network); 28 Nov 2002 10:41:06 -0000 Received: from unknown (HELO fw-cam.cambridge.arm.com) (193.131.176.3) by sources.redhat.com with SMTP; 28 Nov 2002 10:41:06 -0000 Received: by fw-cam.cambridge.arm.com; id KAA28476; Thu, 28 Nov 2002 10:40:52 GMT Received: from unknown(172.16.1.2) by fw-cam.cambridge.arm.com via smap (V5.5) id xma027989; Thu, 28 Nov 02 10:40:13 GMT Received: from pc960.cambridge.arm.com (pc960.cambridge.arm.com [10.1.205.4]) by cam-admin0.cambridge.arm.com (8.9.3/8.9.3) with ESMTP id KAA20141; Thu, 28 Nov 2002 10:40:12 GMT Received: from pc960.cambridge.arm.com (rearnsha@localhost) by pc960.cambridge.arm.com (8.11.6/8.9.3) with ESMTP id gASAeCC03374; Thu, 28 Nov 2002 10:40:12 GMT Message-Id: <200211281040.gASAeCC03374@pc960.cambridge.arm.com> X-Authentication-Warning: pc960.cambridge.arm.com: rearnsha owned process doing -bs To: Andreas Schwab cc: Richard.Earnshaw@arm.com, gdb-patches@sources.redhat.com Reply-To: Richard.Earnshaw@arm.com Organization: ARM Ltd. X-Telephone: +44 1223 400569 (direct+voicemail), +44 1223 400400 (switchbd) X-Fax: +44 1223 400410 X-Address: ARM Ltd., 110 Fulbourn Road, Cherry Hinton, Cambridge CB1 9NJ. Subject: Re: [rfa?] Add frame_align(); Was: ARM stack alignment on hand called functions In-reply-to: Your message of "Thu, 28 Nov 2002 11:20:17 +0100." Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Date: Thu, 28 Nov 2002 02:41:00 -0000 From: Richard Earnshaw X-SW-Source: 2002-11/txt/msg00709.txt.bz2 > Richard Earnshaw writes: >=20 > |> > +/* Ensure that the ARM's stack pointer has the correct alignment fo= r a > |> > + new frame. */ > |> > +static CORE_ADDR > |> > +arm_frame_align (struct gdbarch *gdbarch, CORE_ADDR addr) > |> > +{ > |> > + return (addr & -16); > |> > +} > |>=20 > |> Yuck, two's complement assumption. >=20 > No, -16 is implicitly cast to bfd_vma, which is unsigned, and this > operation is completely defined independent of the representation of > signed integers. Hmm, strictly speaking you are correct. I don't have to like it though,=20 and it means that the code is heavily dependent on the non-obvious fact=20 that addr is an unsigned type to get the correct behaviour (if bfd_vma=20 were to be changed to a signed type then this code would quietly break). So I'll change my comment to: Yuck, implicit cast of negative number to unsigned. R.