This is the mail archive of the
mailing list for the binutils project.
Re: [patch/gas]: simplify frag_grow
- From: Tristan Gingold <gingold at adacore dot com>
- To: Steve Ellcey <sje at cup dot hp dot com>
- Cc: binutils at sourceware dot org
- Date: Wed, 27 Jul 2011 09:38:42 +0200
- Subject: Re: [patch/gas]: simplify frag_grow
- References: <201107262013.p6QKDg308492@sapph05.cup.hp.com>
On Jul 26, 2011, at 10:13 PM, Steve Ellcey wrote:
> Tristan Gingold wrote:
>> The 'while' loop can only be executed once. The function 'frag_new' can
>> either succeed or abort via exit (it uses xmalloc to allocate memory as
>> defined by as.h).
> This doesn't seem to be true. I used the previous version of frag_grow
> and put some print statements in frag_grow and I see multiple passes
> through the while loop in some calls to frag_grow. If I change the
> while to an if (so that it can only be done once) and make no other
> changes, my test case fails.
You're correct. frag_new doesn't necessary calls xmalloc if there is enough room in the current chunk. Hence the bug.
I will rework this patch. I am not very happy with the fact that we can create empty frags until one is big enough.