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

lavr at ncbi dot nlm.nih.gov changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |lavr at ncbi dot nlm.nih.gov

--- Comment #4 from lavr at ncbi dot nlm.nih.gov ---
GCC 11.4 produces the same warning on code as simple as this:

char buf[128];
char* c, q;
// buf is filled with some contents from a read()
if (!*(c = buf + strcspn(buf, kDigits)))
    return 0;
q = c > buf ? c[-1] : '\0';  // THIS LINE GETS A WARNING

array subscript -1 is outside array bounds of 'char[128]' [-Warray-bounds]

Note that there's an explicit check that c > buf before accessing the index
backwards.

Reply via email to