public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "iains at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/63892] [5 Regression] gcc.dg/sibcall-3.c fails on darwin with -m32
Date: Sun, 22 Feb 2015 04:59:00 -0000	[thread overview]
Message-ID: <bug-63892-4-rWAhtmkHi7@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-63892-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63892

--- Comment #17 from Iain Sandoe <iains at gcc dot gnu.org> ---
so .. the problem on Darwin seems to be when we have an alias which is a vtable
reference to a method.

Then we have alias->callers == NULL, and it seems we don't have anything in
place to replace the reference to the alias with a reference to the original. 
I don't know how to do this - so I hacked the following in to keep such cases. 
This allows boostrap to complete (without the
sem_item::target_supports_symbol_aliases_p ()) and all the sibcall cases pass
(the ADT/SmallVectortest.cpp also builds from llvm).  

Not sure what the "proper" fix is ?



diff --git a/gcc/ipa-icf.c b/gcc/ipa-icf.c
index e1af8bf..1539877 100644
--- a/gcc/ipa-icf.c
+++ b/gcc/ipa-icf.c
@@ -662,6 +662,7 @@ sem_function::merge (sem_item *alias_item)
       redirect_callers
     = (!original_discardable
        && !DECL_COMDAT_GROUP (alias->decl)
+       //&& sem_item::target_supports_symbol_aliases_p ()
        && alias->get_availability () > AVAIL_INTERPOSABLE
        && original->get_availability () > AVAIL_INTERPOSABLE
        && !alias->instrumented_version);
@@ -703,6 +704,14 @@ sem_function::merge (sem_item *alias_item)
       /* If alias is non-overwritable then
          all direct calls are safe to be redirected to the original.  */
       bool redirected = false;
+      bool keep = false;
+      /* If we have no callers, then I guess this is addressed by the vtable
+         and we need to move the reference, but I don't know how to do that
+         yet.  */
+      if (!alias->callers
+          && alias->address_taken)
+        keep = true;
+
       while (alias->callers)
     {
       cgraph_edge *e = alias->callers;
@@ -722,9 +731,9 @@ sem_function::merge (sem_item *alias_item)
       && local_original->lto_file_data != alias->lto_file_data)
       local_original->merged = true;

-      /* The alias function is removed if symbol address
-         does not matter.  */
-      if (!alias_address_matters)
+      /* The alias function is removed if the function is neither externally
+         visible or locally addressed.  */
+      if (!alias_address_matters && !keep)
     alias->remove ();

       if (dump_file && redirected)


  parent reply	other threads:[~2015-02-21 23:26 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-15 16:21 [Bug target/63892] New: [5.0 regression] " fxcoudert at gcc dot gnu.org
2014-11-15 16:22 ` [Bug target/63892] " fxcoudert at gcc dot gnu.org
2014-11-15 16:27 ` dominiq at lps dot ens.fr
2014-11-17  9:32 ` rguenth at gcc dot gnu.org
2014-12-10 15:28 ` rguenth at gcc dot gnu.org
2015-02-18 19:49 ` [Bug target/63892] [5 Regression] " law at redhat dot com
2015-02-20  9:32 ` jakub at gcc dot gnu.org
2015-02-20 10:41 ` jakub at gcc dot gnu.org
2015-02-20 12:00 ` marxin at gcc dot gnu.org
2015-02-20 13:04 ` jakub at gcc dot gnu.org
2015-02-20 16:50 ` jakub at gcc dot gnu.org
2015-02-20 16:51 ` jakub at gcc dot gnu.org
2015-02-21 12:51 ` dominiq at lps dot ens.fr
2015-02-21 13:29 ` iains at gcc dot gnu.org
2015-02-21 13:29 ` iains at gcc dot gnu.org
2015-02-21 14:47 ` iains at gcc dot gnu.org
2015-02-21 18:03 ` iains at gcc dot gnu.org
2015-02-22  4:59 ` iains at gcc dot gnu.org [this message]
2015-02-22 13:10 ` iains at gcc dot gnu.org
2015-02-22 16:55 ` iains at gcc dot gnu.org
2015-02-22 22:27 ` howarth at bromo dot med.uc.edu
2015-02-22 23:57 ` iains at gcc dot gnu.org
2015-02-23  8:45 ` iains at gcc dot gnu.org
2015-02-23 11:15 ` jakub at gcc dot gnu.org
2015-02-23 11:15 ` jakub at gcc dot gnu.org
2015-02-27  7:44 ` mrs at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-63892-4-rWAhtmkHi7@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).