This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/68816] gcc fails to detect pointer overflow leading to undefined behaviour
- From: "msebor at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 09 Dec 2015 17:45:34 +0000
- Subject: [Bug c++/68816] gcc fails to detect pointer overflow leading to undefined behaviour
- Auto-submitted: auto-generated
- References: <bug-68816-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68816
Martin Sebor <msebor at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Last reconfirmed|2015-12-09 00:00:00 |
CC| |msebor at gcc dot gnu.org
Resolution|--- |INVALID
--- Comment #5 from Martin Sebor <msebor at gcc dot gnu.org> ---
GCC warns for this case with -O2 -Wstrict-overflow=3 so I think this bug can be
closed as invalid.
$ cat x.c && /build/gcc-trunk-svn/gcc/xgcc -B /build/gcc-trunk-svn/gcc -O2 -S
-Wstrict-overflow=3 -xc++ x.c
extern void g( const char *);
void
f( const char * start, unsigned long ul)
{
if (start + ul < start)
g( start);
}
x.c: In function âvoid f(const char*, long unsigned int)â:
x.c:8:1: warning: assuming pointer wraparound does not occur when comparing P
+- C1 with P +- C2 [-Wstrict-overflow]
}
^