This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Ada] fix glitch in g-debpoo.adb


Tested on i686-linux, committed on trunk.

This patch fixes a glitch caused by the fact that Storage_Offset
is signed, and it is possible to subtract a small address from a
large address and get a negative value. This may seem strange,
but it is quite specifically allowed in the RM, and is what most
implementations including GNAT actually do. Hence we convert to
Integer_Address which is a full range modular type, not subject
to this glitch.

It is not easy to construct a test program since the bad effect
of the wrap around can only be observed in an environment which
provides a very unusual sequence of addresses returned by malloc.

2006-10-31  Vincent Celier  <celier@adacore.com>

	* g-debpoo.adb (Is_Valid): Correctly compute Offset using
	Integer_Address arithmetic, as in Set_Valid.

Attachment: difs
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]