This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix PR ipa/65465
- From: Martin LiÅka <mliska at suse dot cz>
- To: gcc-patches at gcc dot gnu dot org
- Cc: jakub Jelinek <jakub at redhat dot com>
- Date: Thu, 19 Mar 2015 18:26:39 +0100
- Subject: Re: [PATCH] Fix PR ipa/65465
- Authentication-results: sourceware.org; auth=none
- References: <550B0273 dot 8000001 at suse dot cz> <20150319171348 dot GZ1746 at tucnak dot redhat dot com>
On 03/19/2015 06:13 PM, Jakub Jelinek wrote:
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 <mliska@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 <mliska@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 <jakub@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
Thanks for both notes, there's fixed version I'm going to install.
Martin
>From 065789b7b2e8bf94f1caf2a610c5acc1831c20bc Mon Sep 17 00:00:00 2001
From: mliska <mliska@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 <mliska@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 <jakub@redhat.com>
* g++.dg/ipa/pr65465.C: New test.
---
gcc/cgraphunit.c | 3 ++-
gcc/testsuite/g++.dg/ipa/pr65465.C | 10 ++++++++++
2 files changed, 12 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..8ac92e1 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));
thunk.thunk_p = true;
- thunk.this_adjusting = false;
create_edge (target, NULL, count, CGRAPH_FREQ_BASE);
tree arguments = DECL_ARGUMENTS (decl);
diff --git a/gcc/testsuite/g++.dg/ipa/pr65465.C b/gcc/testsuite/g++.dg/ipa/pr65465.C
new file mode 100644
index 0000000..436d88f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ipa/pr65465.C
@@ -0,0 +1,10 @@
+/* { 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 (); }
--
2.1.2