From: Martin Liska Date: Mon, 30 Nov 2020 12:07:27 +0000 (+0100) Subject: IPA: drop implicit_section again X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=cbc4ae2b263bced781a2d2d0cf0085d262040db6;p=gcc.git IPA: drop implicit_section again 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. 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. --- diff --git a/gcc/symtab.c b/gcc/symtab.c index fd7d553c112..6ceec55970d 100644 --- a/gcc/symtab.c +++ b/gcc/symtab.c @@ -1683,7 +1683,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() {}