optimize.c (maybe_clone_body): Set linkage flags before cgraph_same_body_alias.
authorJason Merrill <jason@redhat.com>
Thu, 23 Jun 2011 16:52:56 +0000 (12:52 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Thu, 23 Jun 2011 16:52:56 +0000 (12:52 -0400)
* optimize.c (maybe_clone_body): Set linkage flags before
cgraph_same_body_alias.

From-SVN: r175341

gcc/cp/ChangeLog
gcc/cp/optimize.c

index da39680df0e6ad2632d4ba4d147f2bbd27bac2ee..cb230e25871c739f1df29fe3311239cecd601429 100644 (file)
@@ -1,5 +1,8 @@
 2011-06-23  Jason Merrill  <jason@redhat.com>
 
+       * optimize.c (maybe_clone_body): Set linkage flags before
+       cgraph_same_body_alias.
+
        PR c++/49440
        * class.c (set_linkage_according_to_type): Just check TREE_PUBLIC
        on the type's name.
index 87302dc933d7f71645ffd7d774fdb676a85a0ca3..b9e3551b40c3e094217d1dba97b452a1a3a12a3d 100644 (file)
@@ -310,8 +310,11 @@ maybe_clone_body (tree fn)
              || (HAVE_COMDAT_GROUP
                  && DECL_WEAK (fns[0])))
          && (flag_syntax_only
-             || cgraph_same_body_alias (cgraph_get_node (fns[0]), clone,
-                                        fns[0])))
+             /* Set linkage flags appropriately before
+                cgraph_create_function_alias looks at them.  */
+             || (expand_or_defer_fn_1 (clone)
+                 && cgraph_same_body_alias (cgraph_get_node (fns[0]),
+                                            clone, fns[0]))))
        {
          alias = true;
          if (DECL_ONE_ONLY (fns[0]))