[Bug tree-optimization/107699] [12/13 Regression] False positive -Warray-bounds, non-existent offset reported by GCC

rguenther at suse dot de gcc-bugzilla@gcc.gnu.org
Tue Nov 29 17:54:19 GMT 2022


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107699

--- Comment #7 from rguenther at suse dot de <rguenther at suse dot de> ---
On Tue, 29 Nov 2022, carlosgalvezp at gmail dot com wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107699
> 
> --- Comment #5 from Carlos Galvez <carlosgalvezp at gmail dot com> ---
> > is not good programming practice.
> 
> Sure. In the real world, we have asserts for this. However this is a problem
> when we build for Release mode, in which asserts are disabled and thus this
> warning pops up.

Ah, fair enough - it's that GCC now figures the possibly out-of-bounds
access.  But yes, the diagnostic itself needs improvement.  With
C++23 you could try using [[assume]] to preserve the assertion.


More information about the Gcc-bugs mailing list