Re: [PATCH] Fix up -fsanitize=address ctor order (PR sanitizer/77396, take 2)

2016-09-02 Thread Richard Biener
On September 2, 2016 4:58:20 PM GMT+02:00, Jakub Jelinek wrote: >On Thu, Sep 01, 2016 at 09:58:44AM +0200, Richard Biener wrote: >> Ah, so it expects sth _before_ before-dynamic-init? At least it >seems >> that globals are not only registered inbetween >before/after-dynamic-init. > >Here is upda

[PATCH] Fix up -fsanitize=address ctor order (PR sanitizer/77396, take 2)

2016-09-02 Thread Jakub Jelinek
On Thu, Sep 01, 2016 at 09:58:44AM +0200, Richard Biener wrote: > Ah, so it expects sth _before_ before-dynamic-init? At least it seems > that globals are not only registered inbetween before/after-dynamic-init. Here is updated patch, bootstrapped/regtested on x86_64-linux and i686-linux, ok for

Re: [PATCH] Fix up -fsanitize=address ctor order (PR sanitizer/77396)

2016-09-01 Thread Jakub Jelinek
On Thu, Sep 01, 2016 at 09:58:44AM +0200, Richard Biener wrote: > > and thus if no globals have been registered, dynamic_init_globals is NULL, > > and without the assertion it would crash on dynamic_init_globals->size(). > > The fix would be just to do: > >if (!flags()->check_initialization_ord

Re: [PATCH] Fix up -fsanitize=address ctor order (PR sanitizer/77396)

2016-09-01 Thread Richard Biener
On Thu, 1 Sep 2016, Jakub Jelinek wrote: > On Thu, Sep 01, 2016 at 09:39:37AM +0200, Richard Biener wrote: > > > On Thu, Sep 01, 2016 at 08:59:57AM +0200, Richard Biener wrote: > > > > > Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? > > > > > > > > Hmm, maybe simply do > >

Re: [PATCH] Fix up -fsanitize=address ctor order (PR sanitizer/77396)

2016-09-01 Thread Jakub Jelinek
On Thu, Sep 01, 2016 at 09:39:37AM +0200, Richard Biener wrote: > > On Thu, Sep 01, 2016 at 08:59:57AM +0200, Richard Biener wrote: > > > > Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? > > > > > > Hmm, maybe simply do > > > > > > if (gimple_call_builtin_p (g, BUILT_IN_AS

Re: [PATCH] Fix up -fsanitize=address ctor order (PR sanitizer/77396)

2016-09-01 Thread Richard Biener
On Thu, 1 Sep 2016, Jakub Jelinek wrote: > On Thu, Sep 01, 2016 at 08:59:57AM +0200, Richard Biener wrote: > > > Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? > > > > Hmm, maybe simply do > > > > if (gimple_call_builtin_p (g, BUILT_IN_ASAN_AFTER_DYNAMIC_INIT)) > > {

Re: [PATCH] Fix up -fsanitize=address ctor order (PR sanitizer/77396)

2016-09-01 Thread Jakub Jelinek
On Thu, Sep 01, 2016 at 08:59:57AM +0200, Richard Biener wrote: > > Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? > > Hmm, maybe simply do > > if (gimple_call_builtin_p (g, BUILT_IN_ASAN_AFTER_DYNAMIC_INIT)) > { > gimple *def = SSA_NAME_DEF_STMT (gimple_vuse (g)

Re: [PATCH] Fix up -fsanitize=address ctor order (PR sanitizer/77396)

2016-09-01 Thread Richard Biener
On Wed, 31 Aug 2016, Jakub Jelinek wrote: > Hi! > > libasan currently has an assertion that __asan_before_dynamic_init > is called only after registering at least one global var. I have no idea > how to always guarantee that without making the code too ugly or registering > dummy global vars, si

[PATCH] Fix up -fsanitize=address ctor order (PR sanitizer/77396)

2016-08-31 Thread Jakub Jelinek
Hi! libasan currently has an assertion that __asan_before_dynamic_init is called only after registering at least one global var. I have no idea how to always guarantee that without making the code too ugly or registering dummy global vars, since the registration of globals is done at the end of f