diff mbox series

IPA: drop implicit_section again

Message ID cf203ad1-2cdb-3030-c17c-94d0bbfe7399@suse.cz
State New
Headers show
Series IPA: drop implicit_section again | expand

Commit Message

Martin Liška Nov. 30, 2020, 12:48 p.m. UTC
As mentioned in the PR, since 4656461585bfd0b9 implicit_section
was not set to false when set_section was called with the argument
equal to NULL.

Patch can bootstrap on x86_64-linux-gnu and survives regression tests.

Ready to be installed?
Thanks,
Martin

gcc/ChangeLog:

	PR ipa/98057
	* symtab.c (symtab_node::set_section_for_node): Drop
	implicit_section if x_section is NULL.

gcc/testsuite/ChangeLog:

	PR ipa/98057
	* g++.dg/ipa/pr98057.C: New test.
---
  gcc/symtab.c                       |  5 ++++-
  gcc/testsuite/g++.dg/ipa/pr98057.C | 18 ++++++++++++++++++
  2 files changed, 22 insertions(+), 1 deletion(-)
  create mode 100644 gcc/testsuite/g++.dg/ipa/pr98057.C

Comments

Jeff Law Nov. 30, 2020, 8:45 p.m. UTC | #1
On 11/30/20 5:48 AM, Martin Liška wrote:
> As mentioned in the PR, since 4656461585bfd0b9 implicit_section
> was not set to false when set_section was called with the argument
> equal to NULL.
>
> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
>
> Ready to be installed?
> Thanks,
> Martin
>
> gcc/ChangeLog:
>
>     PR ipa/98057
>     * symtab.c (symtab_node::set_section_for_node): Drop
>     implicit_section if x_section is NULL.
>
> gcc/testsuite/ChangeLog:
>
>     PR ipa/98057
>     * g++.dg/ipa/pr98057.C: New test.
OK
jeff
diff mbox series

Patch

diff --git a/gcc/symtab.c b/gcc/symtab.c
index 393d6b07870..bd9a2fc9885 100644
--- a/gcc/symtab.c
+++ b/gcc/symtab.c
@@ -1679,7 +1679,10 @@  symtab_node::set_section_for_node (const symtab_node &other)
    if (other.x_section)
      x_section = retain_section_hash_entry (other.x_section);
    else
-    x_section = NULL;
+    {
+      x_section = NULL;
+      implicit_section = false;
+    }
  }
  
  /* Workers for set_section.  */
diff --git a/gcc/testsuite/g++.dg/ipa/pr98057.C b/gcc/testsuite/g++.dg/ipa/pr98057.C
new file mode 100644
index 00000000000..9de92548b4c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ipa/pr98057.C
@@ -0,0 +1,18 @@ 
+/* PR ipa/98057 */
+/* { dg-do compile } */
+/* { dg-options "-O3 -ffunction-sections" } */
+
+class JITSymbolResolver {
+  virtual void anchor();
+};
+class MemoryManager {
+  virtual void anchor();
+};
+class MCJITMemoryManager : MemoryManager {
+  void anchor();
+};
+class RTDyldMemoryManager : MCJITMemoryManager, JITSymbolResolver {
+  void anchor();
+};
+void RTDyldMemoryManager::anchor() {}
+void MCJITMemoryManager::anchor() {}