This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/13421] IA32 bigmem pointer subtraction and –ftrapv option causes unjustified program abort
- From: "vik dot heyndrickx at pandora dot be" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 18 Dec 2003 12:21:03 -0000
- Subject: [Bug c/13421] IA32 bigmem pointer subtraction and –ftrapv option causes unjustified program abort
- References: <20031217152930.13421.vik.heyndrickx@pandora.be>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From vik dot heyndrickx at pandora dot be 2003-12-18 12:21 -------
(In reply to comment #10)
> Just as a sidenote: the integer type that can hold pointers is, at
> least in C++, ptrdiff_t. Casting to this type should get you where
> you want.
No, it won't. ptrdiff_t exists also in C by the way. The problem is not the
result of the subtraction but the subtraction itself.
In essence the problem is the signedness of pointers. Later on, I realizes that
when p is a pointer, and q is set to e.g. p + 2, that q < p for some values of
p (e.g. (void*)0x7FFFFFFFu) on IA32. Signedness and an addressible flat memory
space larger than 2^31 are not compatible.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13421