https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81172
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |diagnostic Status|UNCONFIRMED |NEW Last reconfirmed| |2017-06-30 CC| |msebor at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #4 from Martin Sebor <msebor at gcc dot gnu.org> --- Confirmed. There are a few bug reports for missing -Warray-bounds warning that might be worth reviewing as well (e.g., pr67872). I'm not sure distinguishing between forming an out-of-bounds pointer by (a + 5) vs dereferencing a past-the-end element by a[5] is necessary or even a good idea. My concern with having distinct options for such closely related problems is that it might be tricky to get their interaction right in cases like (a + N) and &a[N]: should that trigger -Warray-bounds or -Warray-bounds-pointer-arithmetic, what about when N is not a constant expression? Clang diagnoses the the cases where the offset or index is a constant expression (and under the expected option) but it doesn't diagnose others where the offset/index value is not a constant expression but can be determined to be out of bounds by VRP, for instance. GCC can do better, but it may not be able to distinguish between the two kinds of warnings outside the front end.