Re: [PATCH] ubsan: remove bogus check for flexible array members

2015-02-26 Thread Martin Uecker
Am Thu, 26 Feb 2015 10:05:14 +0100 Jakub Jelinek : > On Thu, Feb 26, 2015 at 12:59:08AM -0800, Martin Uecker wrote: > > > No, it is not bogus nor unnecessary. > > > This isn't about just real flexible arrays, but similar constructs, > > > C++ doesn't have flexible array members, nor C89, so people

Re: [PATCH] ubsan: remove bogus check for flexible array members

2015-02-26 Thread Martin Uecker
Marek Polacek : (Hi Marek and Jakub, I really appreciate your work on GCC and ubsan. I just want to add the minor enhancements necessary to make it really useful for me). > > And this is broken code. I would argue that a user who uses the > > ubsan *expects* this to be diagnosed. Atleast I was

Re: [PATCH] ubsan: remove bogus check for flexible array members

2015-02-26 Thread Marek Polacek
On Thu, Feb 26, 2015 at 11:08:04AM +0100, Richard Biener wrote: > > --- gcc/c-family/c-ubsan.c > > +++ gcc/c-family/c-ubsan.c > > @@ -303,8 +303,9 @@ ubsan_instrument_bounds (location_t loc, tree array, > > tree *index, > > > >/* Detect flexible array members and suchlike. */ > >tree base

Re: [PATCH] ubsan: remove bogus check for flexible array members

2015-02-26 Thread Richard Biener
On Thu, Feb 26, 2015 at 8:32 AM, Marek Polacek wrote: > On Thu, Feb 26, 2015 at 07:36:54AM +0100, Jakub Jelinek wrote: >> On Wed, Feb 25, 2015 at 10:01:07PM -0800, Martin Uecker wrote: >> > this patch removes a bogus check for flexible array members >> > which prevents array references to be instr

Re: [PATCH] ubsan: remove bogus check for flexible array members

2015-02-26 Thread Marek Polacek
On Thu, Feb 26, 2015 at 12:59:08AM -0800, Martin Uecker wrote: > > Thu, 26 Feb 2015 07:36:54 +0100 > Jakub Jelinek : > > On Wed, Feb 25, 2015 at 10:01:07PM -0800, Martin Uecker wrote: > > > this patch removes a bogus check for flexible array members > > > which prevents array references to be inst

Re: [PATCH] ubsan: remove bogus check for flexible array members

2015-02-26 Thread Jakub Jelinek
On Thu, Feb 26, 2015 at 12:59:08AM -0800, Martin Uecker wrote: > > No, it is not bogus nor unnecessary. > > This isn't about just real flexible arrays, but similar constructs, > > C++ doesn't have flexible array members, nor C89, so people use the > > GNU extension of struct S { ... ; char a[0]; }

Re: [PATCH] ubsan: remove bogus check for flexible array members

2015-02-26 Thread Martin Uecker
Thu, 26 Feb 2015 07:36:54 +0100 Jakub Jelinek : > On Wed, Feb 25, 2015 at 10:01:07PM -0800, Martin Uecker wrote: > > this patch removes a bogus check for flexible array members > > which prevents array references to be instrumented in some > > interesting cases. Arrays accessed through pointers ar

Re: [PATCH] ubsan: remove bogus check for flexible array members

2015-02-25 Thread Marek Polacek
On Thu, Feb 26, 2015 at 07:36:54AM +0100, Jakub Jelinek wrote: > On Wed, Feb 25, 2015 at 10:01:07PM -0800, Martin Uecker wrote: > > this patch removes a bogus check for flexible array members > > which prevents array references to be instrumented in some > > interesting cases. Arrays accessed throu

Re: [PATCH] ubsan: remove bogus check for flexible array members

2015-02-25 Thread Jakub Jelinek
On Wed, Feb 25, 2015 at 10:01:07PM -0800, Martin Uecker wrote: > this patch removes a bogus check for flexible array members > which prevents array references to be instrumented in some > interesting cases. Arrays accessed through pointers are now > instrumented correctly. > > The check was unnece