The following patch fixes a LIPO issue with a virtual implicitly
instantiated destructor from an aux module that was needed when we
devirtualized a call from the primary module, but it was not available
(not promoted to global) in aux module since it is DECL_ARTIFICIAL.

Fixes compilation issue, passes regression tests. Ok for google/4_9?

Thanks,
Teresa

2014-10-16  Teresa Johnson  <tejohn...@google.com>

        Google ref b/17971995.
        * l-ipo.c (cgraph_is_aux_decl_external): Artificial functions may
        not be available in primary module.

Index: l-ipo.c
===================================================================
--- l-ipo.c     (revision 216286)
+++ l-ipo.c     (working copy)
@@ -1140,8 +1140,11 @@ cgraph_is_aux_decl_external (struct cgraph_node *n

   /* Comdat or weak functions in aux modules are not external --
      there is no guarantee that the definitition will be emitted
-     in the primary compilation of this auxiliary module.  */
-  if (DECL_COMDAT (decl) || DECL_WEAK (decl))
+     in the primary compilation of this auxiliary module.
+     Functions marked artificial (e.g. an implicitly instantiated virtual
+     destructor) are also not guaranteed to be available in the primary module,
+     as they are not promoted by process_module_scope_static_func.  */
+  if (DECL_COMDAT (decl) || DECL_WEAK (decl) || DECL_ARTIFICIAL (decl))
     return false;

   /* virtual functions won't be deleted in the primary module.  */

-- 
Teresa Johnson | Software Engineer | tejohn...@google.com | 408-460-2413

Reply via email to