Jakub Jelinek :
> On Mon, Nov 10, 2014 at 12:52:02AM -0800, Martin Uecker wrote:
> > Jakub Jelinek :
...
> > The warning seems very useful to me and can easily be turned off.
> > Or one could add -W(no-)warn-struct-hack if really needed.
> >
> > Another odd case is:
> >
> > struct h0b {
> >
On Mon, Nov 10, 2014 at 12:52:02AM -0800, Martin Uecker wrote:
> Jakub Jelinek :
> > On Mon, Nov 10, 2014 at 12:20:03AM -0800, Martin Uecker wrote:
> > > There is also no warning in the following example
> > > when the array is the last element of a struct.
> > >
> > > struct h3 {
> > > in
Jakub Jelinek :
> On Mon, Nov 10, 2014 at 12:20:03AM -0800, Martin Uecker wrote:
> > There is also no warning in the following example
> > when the array is the last element of a struct.
> >
> > struct h3 {
> > int i;
> > int j[3];
> > };
> >
> > struct h3* h3 = malloc(sizeof(stru
On Mon, Nov 10, 2014 at 12:20:03AM -0800, Martin Uecker wrote:
> There is also no warning in the following example
> when the array is the last element of a struct.
>
> struct h3 {
> int i;
> int j[3];
> };
>
> struct h3* h3 = malloc(sizeof(struct h) + 3 * sizeof(int));
> h3->j[4]
I am trying to get more useful warnings for array bounds.
In particular I am interested in cases like this:
void foo(int (*a)[3], int n, int (*b)[n])
{
(*a)[4] = 1;
(*b)[n + 1] = 1;
}
That currently even the first assignment does not produce a warning
is a bit disappointing. (cl