Re: [PATCH] Improve dead code elimination with -fsanitize=address (PR84307)

2018-02-13 Thread Jakub Jelinek
On Fri, Feb 09, 2018 at 05:08:24PM +0100, Paolo Bonzini wrote: > PR sanitizer/84307 > * gcc.dg/asan/pr84307.c: New test. BTW, your testcase shows a more severe problem, that we actually don't handle compound literals correctly. C99 says that: "If the compound literal occurs outside

Re: [PATCH] Improve dead code elimination with -fsanitize=address (PR84307)

2018-02-13 Thread Paolo Bonzini
On 13/02/2018 14:00, Jakub Jelinek wrote: >> Certainly, for now I'll revert. > Reversion is not the right thing, the "fn spec" attributes were clearly > incorrect. So, we should change them to something more conservative that > will work. That would only be "all dots", that is no fnspec at all.

Re: [PATCH] Improve dead code elimination with -fsanitize=address (PR84307)

2018-02-13 Thread Jakub Jelinek
On Tue, Feb 13, 2018 at 01:55:23PM +0100, Paolo Bonzini wrote: > On 13/02/2018 00:49, Jakub Jelinek wrote: > > On Tue, Feb 13, 2018 at 12:41:28AM +0100, Paolo Bonzini wrote: > >> On 09/02/2018 19:07, Jakub Jelinek wrote: > >>> On Fri, Feb 09, 2018 at 07:01:08PM +0100, Richard Biener wrote: > >

Re: [PATCH] Improve dead code elimination with -fsanitize=address (PR84307)

2018-02-13 Thread Paolo Bonzini
On 13/02/2018 00:49, Jakub Jelinek wrote: > On Tue, Feb 13, 2018 at 12:41:28AM +0100, Paolo Bonzini wrote: >> On 09/02/2018 19:07, Jakub Jelinek wrote: >>> On Fri, Feb 09, 2018 at 07:01:08PM +0100, Richard Biener wrote: > which indeed fixes the testcase and seems not to break asan.exp.

Re: [PATCH] Improve dead code elimination with -fsanitize=address (PR84307)

2018-02-13 Thread Jakub Jelinek
On Tue, Feb 13, 2018 at 12:41:28AM +0100, Paolo Bonzini wrote: > On 09/02/2018 19:07, Jakub Jelinek wrote: > > On Fri, Feb 09, 2018 at 07:01:08PM +0100, Richard Biener wrote: > >>> which indeed fixes the testcase and seems not to break asan.exp. > >> > >> Huh. Need to double check why that makes

Re: [PATCH] Improve dead code elimination with -fsanitize=address (PR84307)

2018-02-12 Thread Paolo Bonzini
On 09/02/2018 19:07, Jakub Jelinek wrote: > On Fri, Feb 09, 2018 at 07:01:08PM +0100, Richard Biener wrote: >>> which indeed fixes the testcase and seems not to break asan.exp. >> >> Huh. Need to double check why that makes sense ;) > > I think it does, for both ASAN_CHECK and ASAN_MARK the

Re: [PATCH] Improve dead code elimination with -fsanitize=address (PR84307)

2018-02-12 Thread Jakub Jelinek
On Mon, Feb 12, 2018 at 01:02:20PM +0100, Paolo Bonzini wrote: > On 12/02/2018 09:56, Richard Biener wrote: > >>> I think it does, for both ASAN_CHECK and ASAN_MARK the pointer argument > >>> is the second one, the first one is an integer argument with flags. > >>> And ASAN_MARK, both poison and

Re: [PATCH] Improve dead code elimination with -fsanitize=address (PR84307)

2018-02-12 Thread Paolo Bonzini
On 12/02/2018 09:56, Richard Biener wrote: >>> I think it does, for both ASAN_CHECK and ASAN_MARK the pointer argument >>> is the second one, the first one is an integer argument with flags. >>> And ASAN_MARK, both poison and unpoison, works kind like a clobber on >>> the >>> referenced variable,

Re: [PATCH] Improve dead code elimination with -fsanitize=address (PR84307)

2018-02-12 Thread Richard Biener
On Fri, Feb 9, 2018 at 9:10 PM, Richard Biener wrote: > On February 9, 2018 7:07:45 PM GMT+01:00, Jakub Jelinek > wrote: >>On Fri, Feb 09, 2018 at 07:01:08PM +0100, Richard Biener wrote: >>> >which indeed fixes the testcase and seems not to break

Re: [PATCH] Improve dead code elimination with -fsanitize=address (PR84307)

2018-02-09 Thread Richard Biener
On February 9, 2018 7:07:45 PM GMT+01:00, Jakub Jelinek wrote: >On Fri, Feb 09, 2018 at 07:01:08PM +0100, Richard Biener wrote: >> >which indeed fixes the testcase and seems not to break asan.exp. >> >> Huh. Need to double check why that makes sense ;) > >I think it does, for

Re: [PATCH] Improve dead code elimination with -fsanitize=address (PR84307)

2018-02-09 Thread Jakub Jelinek
On Fri, Feb 09, 2018 at 07:01:08PM +0100, Richard Biener wrote: > >which indeed fixes the testcase and seems not to break asan.exp. > > Huh. Need to double check why that makes sense ;) I think it does, for both ASAN_CHECK and ASAN_MARK the pointer argument is the second one, the first one is

Re: [PATCH] Improve dead code elimination with -fsanitize=address (PR84307)

2018-02-09 Thread Jakub Jelinek
On Fri, Feb 09, 2018 at 05:40:09PM +0100, Richard Biener wrote: > On February 9, 2018 5:08:24 PM GMT+01:00, Paolo Bonzini > wrote: > >Hi all, > > > >in this PR, a dead reference to a function pointer cannot be optimized > >out by the compiler because some ASAN_MARK UNPOISON

Re: [PATCH] Improve dead code elimination with -fsanitize=address (PR84307)

2018-02-09 Thread Richard Biener
On February 9, 2018 6:23:37 PM GMT+01:00, Paolo Bonzini wrote: >On 09/02/2018 17:40, Richard Biener wrote: >> On February 9, 2018 5:08:24 PM GMT+01:00, Paolo Bonzini > wrote: >>> Another possibility which I considered but did not implement is to >mark >>> the

Re: [PATCH] Improve dead code elimination with -fsanitize=address (PR84307)

2018-02-09 Thread Paolo Bonzini
On 09/02/2018 17:40, Richard Biener wrote: > On February 9, 2018 5:08:24 PM GMT+01:00, Paolo Bonzini > wrote: >> Another possibility which I considered but did not implement is to mark >> the UNPOISON calls so that they do not cause the parameter to escape. > > I'd do this,

Re: [PATCH] Improve dead code elimination with -fsanitize=address (PR84307)

2018-02-09 Thread Richard Biener
On February 9, 2018 5:08:24 PM GMT+01:00, Paolo Bonzini wrote: >Hi all, > >in this PR, a dead reference to a function pointer cannot be optimized >out by the compiler because some ASAN_MARK UNPOISON calls, which are >placed before the store, cause the containing struct to escape.