This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/86972] [6/7/8/9 Regression] Incorrect array-bounds warning with -O2 when creating pointer from array
- 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: Thu, 16 Aug 2018 17:14:44 +0000
- Subject: [Bug c/86972] [6/7/8/9 Regression] Incorrect array-bounds warning with -O2 when creating pointer from array
- Auto-submitted: auto-generated
- References: <bug-86972-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86972
Martin Sebor <msebor at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC| |msebor at gcc dot gnu.org
Resolution|--- |INVALID
--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> ---
The result of pointer addition or subtraction must point at an existing element
of an array or just past the last one, otherwise the behavior is undefined.
In the test case in comment #0 the subtraction doesn't satisfy this requirement
and the warning correctly points that out. What makes you think otherwise?