This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Improve dead code elimination with -fsanitize=address (PR84307)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Richard Biener <richard dot guenther at gmail dot com>
- Cc: gcc-patches at gcc dot gnu dot org, Paolo Bonzini <bonzini at gnu dot org>, marcandre dot lureau at redhat dot com, mliska at suse dot cz
- Date: Fri, 9 Feb 2018 17:53:26 +0100
- Subject: Re: [PATCH] Improve dead code elimination with -fsanitize=address (PR84307)
- Authentication-results: sourceware.org; auth=none
- References: <1518192504-49084-1-git-send-email-bonzini@gnu.org> <B22374CA-583E-4779-9D84-73AC7F76ECF2@gmail.com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
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 <bonzini@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