On Thu, Mar 19, 2015 at 06:08:03PM +0100, Martin Liška wrote:
> >From 1b0416658cf59348664d44b14518c994075fd9bd Mon Sep 17 00:00:00 2001
> From: mliska <mli...@suse.cz>
> Date: Thu, 19 Mar 2015 15:36:34 +0100
> Subject: [PATCH] Fix for PR ipa/65465.
> 
> gcc/ChangeLog:
> 
> 2015-03-19  Martin Liska  <mli...@suse.cz>
> 
>       PR ipa/65465
>       * cgraphunit.c (cgraph_node::create_wrapper): Correctly reset
>       all fields of cgraph_thunk_info.
> 
> gcc/testsuite/ChangeLog:
> 
> 2015-03-19  Jakub Jelinek  <ja...@redhat.com>
> 
>       * g++.dg/ipa/pr65465.C: New test.
> ---
>  gcc/cgraphunit.c                   |  3 ++-
>  gcc/testsuite/g++.dg/ipa/pr65465.C | 16 ++++++++++++++++
>  2 files changed, 18 insertions(+), 1 deletion(-)
>  create mode 100644 gcc/testsuite/g++.dg/ipa/pr65465.C
> 
> diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
> index e640907..8b7d056 100644
> --- a/gcc/cgraphunit.c
> +++ b/gcc/cgraphunit.c
> @@ -2484,8 +2484,9 @@ cgraph_node::create_wrapper (cgraph_node *target)
>  
>    /* Turn alias into thunk and expand it into GIMPLE representation.  */
>    definition = true;
> +
> +  memset (&thunk, 0, sizeof(cgraph_thunk_info));

Please put space after sizeof.

>    thunk.thunk_p = true;
> -  thunk.this_adjusting = false;
>    create_edge (target, NULL, count, CGRAPH_FREQ_BASE);
>  
>    tree arguments = DECL_ARGUMENTS (decl);

Ok for trunk with that change.

> diff --git a/gcc/testsuite/g++.dg/ipa/pr65465.C 
> b/gcc/testsuite/g++.dg/ipa/pr65465.C
> new file mode 100644
> index 0000000..004b76e
> --- /dev/null
> +++ b/gcc/testsuite/g++.dg/ipa/pr65465.C
> @@ -0,0 +1,16 @@
> +/* { dg-do compile } */
> +/* { dg-options "-O2" } */
> +
> +struct A {};
> +struct B { virtual A foo () const; };
> +struct C { A foo () const; };
> +struct D : virtual B { A foo () const {} };
> +struct F : D { virtual int bar () const; };
> +int F::bar () const { return 0; }
> +A C::foo () const { return A (); }
> +
> +int
> +main ()
> +{
> +  return 0;
> +}

Why do you need main for a dg-do compile testcase?
And even if you do for some reason, the return 0; in there
is implicit in C++.

        Jakub

Reply via email to