Re: PING: [PATCH] Fix a bug of addrmap

Tom Tromey
2008-11-26T16:55:13Z

>>>>> "Joel" == Joel Brobecker <brobecker@adacore.com> writes:

Joel> Did you familiarize yourself with the code that you'd say that
Joel> the patch sounds good to you?

I looked at it again today.

I re-read the contract for this function, and it seems pretty clear
that the current behavior is intended:

/* In the mutable address map MAP, associate the addresses from START
to END_INCLUSIVE that are currently associated with NULL with OBJ
instead. Addresses mapped to an object other than NULL are left
unchanged.

In particular, "currently associated with NULL" is the key.

My understanding now is that this data structure is designed to be
built bottom-up. So, I think that this is a bug in the caller, and
that the test I wrote is actually not correct.

Of course, it would be ok to change addrmap's contract. But, if we
want to do this then I think we would need more tests covering other
corner cases.

BTW, addrmap is nice code. It has all the hallmarks of the Blandy
style.

Tom