This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/86972] [6/7/8/9 Regression] Incorrect array-bounds warning with -O2 when creating pointer from array


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?

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]