This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: RFC: Fix an infinite loop placing sections in relocatable objects
On Thu, Feb 16, 2006 at 02:23:47PM -0800, Jim Blandy wrote:
> On 2/16/06, Daniel Jacobowitz <drow@false.org> wrote:
> > > > + ULONGEST align = 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.
Oh! Right. Thanks.
--
Daniel Jacobowitz
CodeSourcery