[Bug middle-end/93582] [10 Regression] -Warray-bounds gives error: array subscript 0 is outside array bounds of struct E[1]
ajax at redhat dot com
gcc-bugzilla@gcc.gnu.org
Tue Feb 4 21:09:00 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93582
Adam Jackson <ajax at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ajax at redhat dot com
--- Comment #5 from Adam Jackson <ajax at redhat dot com> ---
(In reply to Martin Sebor from comment #4)
> It seems like the reporter might be conflating the forming of a past-the-end
> pointer (what the GRABEXT macro does) with dereferencing that pointer (the
> use of the -> operator with the result).
I'm not conflating it, I'm pretty sure the whole point of computing that
address
is to dereference it because that's where the data I want is. The caller is
doing somemthing of the form:
struct image {
int w, h, bpp;
// unsigned char pixels[];
};
struct image *i = malloc(sizeof(*i) + w * h * bpp);
This is not uncommon in code older than zero-length arrays.
More information about the Gcc-bugs
mailing list