This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/22485] pointer +- integer is never NULL
- From: "gdr at integrable-solutions dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 14 Jul 2005 15:19:40 -0000
- Subject: [Bug c/22485] pointer +- integer is never NULL
- References: <20050714131031.22485.mattias@virtutech.se>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From gdr at integrable-solutions dot net 2005-07-14 15:19 -------
Subject: Re: pointer +- integer is never NULL
"falk at debian dot org" <gcc-bugzilla@gcc.gnu.org> writes:
| (In reply to comment #4)
| > Hmmmm.
| > I swear we just had this discussion for VRP purposes, and that a bug was
| > recently fixed so that we don't assume that pointer + - integer is NULL.
|
| Well, I checked C99 and C++, and they explain a few cases, never mentioning
| null pointers, and then say everything else is undefined. Maybe this was
| different in C89? Seems unlikely, though...
I'm failing to find anything in the C++ standard that suggests that the
following shall be undefined
(reinterpret_cast<int*>(0) + 5) - 5
-- Gaby
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22485