This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Fix obscure obstack bug
DJ Delorie wrote:-
>
> What about if the allocator actually *allocates* a larger chunk the
> first time? In that case, you *would* want to use h->chunk_size.
> Perhaps the user-defined allocator must guarantee that h->chunk_size
> and the initial allocation agree?
I think it's counterintuitive if you allocate a size other than that
requested.
Note my patch only fixes the initial allocation - all subsequent
allocations are handled by different code in obstack.c that does not
have the bug; and does not use h->chunk_size after calling the
allocation routine. So the patch is also making obstack.c internally
self-consistent.
Neil.