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 <bonz...@gnu.org> > 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. > >(Without -fsanitize=address, the dead code is eliminated by the first > >DSE pass). > > > >The fix, which works at least for this testcase, is to copy part of the > >sanopt dead code elimination pass early, so that the compiler can see > >fewer UNPOISON calls. I am not sure this is general enough, due to > >the very limited data flow analysis done by > >sanitize_asan_mark_unpoison. > >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, thus assign proper fnspec attributes to the asan functions.
It already uses ".R.." "fn spec". Jakub