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.

Reply via email to