From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16677 invoked by alias); 16 Feb 2006 22:23:54 -0000 Received: (qmail 16668 invoked by uid 22791); 16 Feb 2006 22:23:53 -0000 X-Spam-Check-By: sourceware.org Received: from xproxy.gmail.com (HELO xproxy.gmail.com) (66.249.82.192) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 16 Feb 2006 22:23:50 +0000 Received: by xproxy.gmail.com with SMTP id s7so161620wxc for ; Thu, 16 Feb 2006 14:23:49 -0800 (PST) Received: by 10.70.61.11 with SMTP id j11mr223978wxa; Thu, 16 Feb 2006 14:23:48 -0800 (PST) Received: by 10.70.125.17 with HTTP; Thu, 16 Feb 2006 14:23:47 -0800 (PST) Message-ID: <8f2776cb0602161423m743b170h46b0aa232b2191d1@mail.gmail.com> Date: Thu, 16 Feb 2006 22:23:00 -0000 From: Jim Blandy To: gdb-patches@sourceware.org Subject: Re: RFC: Fix an infinite loop placing sections in relocatable objects In-Reply-To: <20060216221726.GA1137@nevyn.them.org> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <20060216152444.GA22371@nevyn.them.org> <20060216221726.GA1137@nevyn.them.org> X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-02/txt/msg00330.txt.bz2 On 2/16/06, Daniel Jacobowitz wrote: > > > + ULONGEST align =3D 1 << bfd_get_section_alignment (abfd, sect); > > > > I think bfd_get_section_alignment can return values bigger than 31 in > > general, and this is undefined in this case. > > It's only used in math with a CORE_ADDR, which will be the size of a > bfd_vma. Can bfd_get_section_alignment return a shift greater than the > size of a bfd_vma? What would that mean? No, what he means is that the literal "1" is just an 'int', so the shift will be done in the width of an int. The conversion to ULONGEST happens later. The fix is to cast the 1 to ULONGEST before shifting it.