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

--- Comment #10 from Martin Sebor <msebor at gcc dot gnu.org> ---
An array is implicitly converted to a pointer; it's not an lvalue.  But I think
we're splitting hairs.  I agree we want a warning for passing past-the-end
pointers to functions that might inadvertently dereference it; I plan to
implement it for GCC 11.

The reference in

    int a[1][4];
    printf("%p\n", (void *)&a[1][1]);

is of course undefined, but when the warning sees the address-of operator it
allows off-by-one indices.  That's necessary only for the rightmost index but
not otherwise.  The missing warning here is the subject of pr84079.  I have a
simple fix that handles this case.

Reply via email to