This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/32628] [4.3 Regression] bogus integer overflow warning
- From: "rguenth at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 15 Jan 2008 14:44:10 -0000
- Subject: [Bug middle-end/32628] [4.3 Regression] bogus integer overflow warning
- References: <bug-32628-7834@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #8 from rguenth at gcc dot gnu dot org 2008-01-15 14:44 -------
Reduced testcase:
int f(char *device)
{
return device == ((char *)0 + ~0UL);
}
for building the POINTER_PLUS_EXPR we convert the unsigned offset to
sizetype which causes the double-int (-1, 0) to sign-extend to (-1, -1)
signalling overflow (the positive value doesn't fit in sizetype).
In the context of POINTER_PLUS_EXPRs the sizetype offset depending on
evaluation context has an effective range of [-INT_MIN, UINT_MAX].
So in principle we want to not treat the sign/zero extension
that happens when converting from/to sizetype as overflow.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|pinskia at gcc dot gnu dot |rguenth at gcc dot gnu dot
|org |org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32628