On Fri, Oct 27, 2017 at 12:47:12PM +0200, Martin Liška wrote:
> Hello.
> 
> This is small improvement that can catch a virtual call after a lifetime
> scope of an object.
> 
> 
> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.
> 
> Ready to be installed?

The decl.c change seems to be only incremental change from a not publicly
posted patch rather than the full diff against trunk.

> 2017-10-27  Martin Liska  <mli...@suse.cz>
> 
>       * decl.c (begin_destructor_body): In case of disabled recovery,
>       we can zero object in order to catch virtual calls after
>       an object lifetime.
> 
> gcc/testsuite/ChangeLog:
> 
> 2017-10-27  Martin Liska  <mli...@suse.cz>
> 
>       * g++.dg/ubsan/vptr-12.C: New test.
> ---
>  gcc/cp/decl.c                        |  3 ++-
>  gcc/testsuite/g++.dg/ubsan/vptr-12.C | 26 ++++++++++++++++++++++++++
>  2 files changed, 28 insertions(+), 1 deletion(-)
>  create mode 100644 gcc/testsuite/g++.dg/ubsan/vptr-12.C
> 
> 

> diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
> index 15a8d283353..69636e30008 100644
> --- a/gcc/cp/decl.c
> +++ b/gcc/cp/decl.c
> @@ -15281,7 +15281,8 @@ begin_destructor_body (void)
>         /* Clobbering an empty base is harmful if it overlays real data.  */
>         && !is_empty_class (current_class_type))
>       {
> -       if (sanitize_flags_p (SANITIZE_VPTR))
> +       if (sanitize_flags_p (SANITIZE_VPTR)
> +           && (flag_sanitize_recover & SANITIZE_VPTR) == 0)
>           {
>             tree fndecl = builtin_decl_explicit (BUILT_IN_MEMSET);
>             tree call = build_call_expr (fndecl, 3,

        Jakub

Reply via email to