public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/63892] New: [5.0 regression] gcc.dg/sibcall-3.c fails on darwin with -m32
@ 2014-11-15 16:21 fxcoudert at gcc dot gnu.org
  2014-11-15 16:22 ` [Bug target/63892] " fxcoudert at gcc dot gnu.org
                   ` (24 more replies)
  0 siblings, 25 replies; 26+ messages in thread
From: fxcoudert at gcc dot gnu.org @ 2014-11-15 16:21 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 63892
           Summary: [5.0 regression] gcc.dg/sibcall-3.c fails on darwin
                    with -m32
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: fxcoudert at gcc dot gnu.org

Created attachment 33986
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33986&action=edit
Assembler generated by the 4.9.2 compiler and trunk

Compiling sibcall-3.c with "-O2 -foptimize-sibling-calls -m32" on
x86_64-apple-darwin14 leads to runtime abort: on line 76, the test (trackpoint
!= stackpos) is true.

I attach to this PR the sibcall-3.c source (slightly amended so it prints out
the values of the pointers that should be equal), and the assembler generated
by the 4.9.2 compiler and trunk, both with "-O2 -foptimize-sibling-calls -m32".


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [Bug target/63892] [5.0 regression] gcc.dg/sibcall-3.c fails on darwin with -m32
  2014-11-15 16:21 [Bug target/63892] New: [5.0 regression] gcc.dg/sibcall-3.c fails on darwin with -m32 fxcoudert at gcc dot gnu.org
@ 2014-11-15 16:22 ` fxcoudert at gcc dot gnu.org
  2014-11-15 16:27 ` dominiq at lps dot ens.fr
                   ` (23 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: fxcoudert at gcc dot gnu.org @ 2014-11-15 16:22 UTC (permalink / raw)
  To: gcc-bugs

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

Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|                            |x86_64-apple-darwin14
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-11-15
               Host|                            |x86_64-apple-darwin14
     Ever confirmed|0                           |1
              Build|                            |x86_64-apple-darwin14

--- Comment #1 from Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> ---
Also, maybe worth mentioning: there was a patch (PR60104) for
sibling-tail-calls that broke darwin earlier this year, maybe this is related.


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [Bug target/63892] [5.0 regression] gcc.dg/sibcall-3.c fails on darwin with -m32
  2014-11-15 16:21 [Bug target/63892] New: [5.0 regression] gcc.dg/sibcall-3.c fails on darwin with -m32 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
                   ` (22 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: dominiq at lps dot ens.fr @ 2014-11-15 16:27 UTC (permalink / raw)
  To: gcc-bugs

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

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |marxin at gcc dot gnu.org

--- Comment #2 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
This is cause by r216305: no failure with r216304.


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [Bug target/63892] [5.0 regression] gcc.dg/sibcall-3.c fails on darwin with -m32
  2014-11-15 16:21 [Bug target/63892] New: [5.0 regression] gcc.dg/sibcall-3.c fails on darwin with -m32 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
                   ` (21 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-11-17  9:32 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |5.0


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [Bug target/63892] [5.0 regression] gcc.dg/sibcall-3.c fails on darwin with -m32
  2014-11-15 16:21 [Bug target/63892] New: [5.0 regression] gcc.dg/sibcall-3.c fails on darwin with -m32 fxcoudert at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  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
                   ` (20 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-12-10 15:28 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
           Priority|P3                          |P1


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [Bug target/63892] [5 Regression] gcc.dg/sibcall-3.c fails on darwin with -m32
  2014-11-15 16:21 [Bug target/63892] New: [5.0 regression] gcc.dg/sibcall-3.c fails on darwin with -m32 fxcoudert at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2014-12-10 15:28 ` rguenth at gcc dot gnu.org
@ 2015-02-18 19:49 ` law at redhat dot com
  2015-02-20  9:32 ` jakub at gcc dot gnu.org
                   ` (19 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: law at redhat dot com @ 2015-02-18 19:49 UTC (permalink / raw)
  To: gcc-bugs

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

Jeffrey A. Law <law at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P2
                 CC|                            |law at redhat dot com
           Assignee|unassigned at gcc dot gnu.org      |mliska at suse dot cz

--- Comment #3 from Jeffrey A. Law <law at redhat dot com> ---
Darwin does not support weak aliases.  As a result the ICF code has to be more
conservative in how it transforms the resulting code when an ICF opportunity
exists.

Normally (if we have weak aliases), recurser_void1 will be made a weak alias to
recurser_void2.  That in turn exposes recurser_void2 as self recursion which
gets optimized into an appropriate loop by the 2nd tail call optimizer.  And
(of course) the test passes with ICF enabled.  For darwin, we don't have weak
aliases, so none of this applies.

For darwin, in the non-ICF case we ultimately determine that both recurser
functions are local and we can change their signature.  And they're both
changed to use register passing for some arguments.  As a result when it comes
time to try a tail call sequence, neither function has a need for parameters on
the stack, so that test passes and ultimately we emit the optimized tail call
sequence.

In the ICF case, recurser_void2 has the right bits (local/signature changeable)
and it's changed to use register passing conventions (ie, no stack space). 
However recurser_void1 doesn't have the "local" bit set and thus it's not
considered eligible for register passing conventions (arguments on the stack).

This mismatch in stack handling for parameters ultimately means that we can't
use a tail call for the call from recurser_void2 to recurser_void1 and the test
fails.

It's unclear to me if the ICF bits should be setting flags in the cgraph nodes
when it merges functions or if those bits should be set elsewhere.  It may also
be possible to fix this in the x86 backend perhaps if there's a way to
recognize the alias/thunk nature of recurser_void1 and follow that to
recurser_void2 and use the flags from the latter for determining the calling
conventions for the former.

Assigning to mliksa for further analysis.


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [Bug target/63892] [5 Regression] gcc.dg/sibcall-3.c fails on darwin with -m32
  2014-11-15 16:21 [Bug target/63892] New: [5.0 regression] gcc.dg/sibcall-3.c fails on darwin with -m32 fxcoudert at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  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
                   ` (18 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-02-20  9:32 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hubicka at gcc dot gnu.org

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
So, during ICF we don't create alias because
sem_item::target_supports_symbol_aliases_p () tells us not to.
But I really don't see a reason why we couldn't try to redirect_callers in this
case, both original and alias are local functions without address taken.
There is another case that worries me - if the above mentioned function returns
false, we set create_thunk even for stdarg_p functions.

So, I think we should do something like:

--- gcc/ipa-icf.c.jj    2015-02-19 12:52:33.000000000 +0100
+++ gcc/ipa-icf.c    2015-02-20 10:06:04.532637240 +0100
@@ -651,7 +651,9 @@ sem_function::merge (sem_item *alias_ite
      section (or we risk link failures when section is discarded).  */
   if ((original_address_matters
        && alias_address_matters)
-      || original_discardable)
+      || original_discardable
+      || DECL_COMDAT_GROUP (alias->decl)
+      || !sem_item::target_supports_symbol_aliases_p ())
     {
       create_thunk = !stdarg_p (TREE_TYPE (alias->decl));
       create_alias = false;
@@ -659,6 +661,7 @@ sem_function::merge (sem_item *alias_ite
          the extra thunk wrapper for direct calls.  */
       redirect_callers
     = (!original_discardable
+       && !DECL_COMDAT_GROUP (alias->decl)
        && alias->get_availability () > AVAIL_INTERPOSABLE
        && original->get_availability () > AVAIL_INTERPOSABLE
        && !alias->instrumented_version);
@@ -670,13 +673,6 @@ sem_function::merge (sem_item *alias_ite
       redirect_callers = false;
     }

-  if (create_alias && (DECL_COMDAT_GROUP (alias->decl)
-               || !sem_item::target_supports_symbol_aliases_p ()))
-    {
-      create_alias = false;
-      create_thunk = true;
-    }
-
   /* We want thunk to always jump to the local function body
      unless the body is comdat and may be optimized out.  */
   if ((create_thunk || redirect_callers)

Unfortunately this ICEs on the testcase in question, when we reach:
725          /* The alias function is removed if symbol address
726             does not matter.  */
727          if (!alias_address_matters)
728        alias->remove ();
because in
1645    void
1646    sem_item_optimizer::remove_symtab_node (symtab_node *node)
1647    {
1648      gcc_assert (!m_classes.elements());
1649    
1650      m_removed_items_set.add (node);
1651    }
called during the alias->remove ()
m_classes.elements() is 3.  I'm not familiar with that code, Martin/Honza, can
you please have a look?

And, another thing, not analyzed fully, is that when we create a thunk to the
local calling convention function and the thunk isn't visible either, the
question is why it doesn't use the same calling convention (i.e. local again).

Last thing, I believe we should change the testcase anyway, either use
-fno-ipa-icf or add say some volatile int v; v++;
into one of the functions, so that sibcall-3.c tests what it originally meant
to test.  With ICF it can be turned into a tail recursion test, while clearly
originally it was meant to be a tail call test.
We can certainly copy the current testcase into a new one...


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [Bug target/63892] [5 Regression] gcc.dg/sibcall-3.c fails on darwin with -m32
  2014-11-15 16:21 [Bug target/63892] New: [5.0 regression] gcc.dg/sibcall-3.c fails on darwin with -m32 fxcoudert at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  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
                   ` (17 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-02-20 10:41 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 34815
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34815&action=edit
gcc5-pr63892.patch

This untested patch fixes the issue too, though if the #c4 patch could be made
to work, it might be perhaps unnecessary because we would never try to add
thunks in between local functions.  Or is there any case where it would make
sense to add them rather than redirect callers?


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [Bug target/63892] [5 Regression] gcc.dg/sibcall-3.c fails on darwin with -m32
  2014-11-15 16:21 [Bug target/63892] New: [5.0 regression] gcc.dg/sibcall-3.c fails on darwin with -m32 fxcoudert at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  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
                   ` (16 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: marxin at gcc dot gnu.org @ 2015-02-20 12:00 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Martin Liška <marxin at gcc dot gnu.org> ---
Created attachment 34817
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34817&action=edit
Fixed IPA ICF hooks

Hello Jakub.

Your patch in #c4 is correct, assert is caused due to wrong placement of
unregister hooks. Please see the patch, I tested on my x86_64-linux-pc machine
(where I return false in target_supports_symbol_aliases_p) and it works me.

Thanks,
Martin
>From gcc-bugs-return-477924-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri Feb 20 12:04:58 2015
Return-Path: <gcc-bugs-return-477924-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 11636 invoked by alias); 20 Feb 2015 12:04:58 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 11543 invoked by uid 55); 20 Feb 2015 12:04:54 -0000
From: "uros at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug rtl-optimization/63475] Postreload CSE propagates aliased memory operand
Date: Fri, 20 Feb 2015 12:04:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: rtl-optimization
X-Bugzilla-Version: 5.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: uros at gcc dot gnu.org
X-Bugzilla-Status: RESOLVED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: ubizjak at gmail dot com
X-Bugzilla-Target-Milestone: 4.9.3
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-63475-4-lT8JnaLZs7@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-63475-4@http.gcc.gnu.org/bugzilla/>
References: <bug-63475-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-02/txt/msg02257.txt.bz2
Content-length: 2060

https://gcc.gnu.org/bugzilla/show_bug.cgi?idc475

--- Comment #9 from uros at gcc dot gnu.org ---
Author: uros
Date: Fri Feb 20 12:04:21 2015
New Revision: 220854

URL: https://gcc.gnu.org/viewcvs?rev"0854&root=gcc&view=rev
Log:
    Backport from mainline
    2015-01-22 Wei Mi <wmi@google.com>

    PR rtl-optimization/64557
    * dse.c (record_store): Call get_addr for mem_addr.
    (check_mem_read_rtx): Likewise.

    Backport from mainline
    2014-10-20  Uros Bizjak  <ubizjak@gmail.com>

    * varasm.c (const_alias_set): Remove.
    (init_varasm_once): Remove initialization of const_alias_set.
    (build_constant_desc): Do not set alias set to const_alias_set.

    Backport from mainline
    2014-10-14  Uros Bizjak  <ubizjak@gmail.com>

    PR rtl-optimization/63475
    * alias.c (true_dependence_1): Always use get_addr to extract
    true address operands from x_addr and mem_addr.  Use extracted
    address operands to check for references with alignment ANDs.
    Use extracted address operands with find_base_term and
    base_alias_check. For noncanonicalized operands call canon_rtx with
    extracted address operand.
    (write_dependence_1): Ditto.
    (may_alias_p): Ditto.  Remove unused calls to canon_rtx.

    Backport from mainline
    2014-10-10  Uros Bizjak  <ubizjak@gmail.com>

    PR rtl-optimization/63483
    * alias.c (true_dependence_1): Do not exit early for MEM_READONLY_P
    references when alignment ANDs are involved.
    (write_dependence_p): Ditto.
    (may_alias_p): Ditto.

    Backport from mainline
    2013-03-26  Richard Biener  <rguenther@suse.de>

    * alias.c (find_base_term): Avoid redundant and not used recursion.
    (base_alias_check): Get the initial base term from the caller.
    (true_dependence_1): Compute and pass base terms to base_alias_check.
    (write_dependence_p): Likewise.
    (may_alias_p): Likewise.


Modified:
    branches/gcc-4_8-branch/gcc/ChangeLog
    branches/gcc-4_8-branch/gcc/alias.c
    branches/gcc-4_8-branch/gcc/dse.c
    branches/gcc-4_8-branch/gcc/varasm.c


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [Bug target/63892] [5 Regression] gcc.dg/sibcall-3.c fails on darwin with -m32
  2014-11-15 16:21 [Bug target/63892] New: [5.0 regression] gcc.dg/sibcall-3.c fails on darwin with -m32 fxcoudert at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  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
                   ` (15 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-02-20 13:04 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 34818
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34818&action=edit
V499

And let's copy and adjust the sibcall-{3,4}.c testcases so that they aren't ICF
optimized, so that we also test what we originally meant to.


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [Bug target/63892] [5 Regression] gcc.dg/sibcall-3.c fails on darwin with -m32
  2014-11-15 16:21 [Bug target/63892] New: [5.0 regression] gcc.dg/sibcall-3.c fails on darwin with -m32 fxcoudert at gcc dot gnu.org
                   ` (8 preceding siblings ...)
  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
                   ` (14 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-02-20 16:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Author: jakub
Date: Fri Feb 20 16:44:37 2015
New Revision: 220875

URL: https://gcc.gnu.org/viewcvs?rev=220875&root=gcc&view=rev
Log:
    PR target/63892
    * ipa-icf.c (sem_function::merge): If DECL_COMDAT_GROUP (alias->decl),
    don't try to create_thunk if stdarg_p.  If
    !sem_item::target_supports_symbol_aliases_p (), similarly, and try to
    redirect_callers if possible.
    (sem_item_optimizer::execute): Call unregister_hooks here...
    (ipa_icf_driver): ... instead of here.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/ipa-icf.c


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [Bug target/63892] [5 Regression] gcc.dg/sibcall-3.c fails on darwin with -m32
  2014-11-15 16:21 [Bug target/63892] New: [5.0 regression] gcc.dg/sibcall-3.c fails on darwin with -m32 fxcoudert at gcc dot gnu.org
                   ` (9 preceding siblings ...)
  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
                   ` (13 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-02-20 16:51 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #11 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Should be fixed now.


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [Bug target/63892] [5 Regression] gcc.dg/sibcall-3.c fails on darwin with -m32
  2014-11-15 16:21 [Bug target/63892] New: [5.0 regression] gcc.dg/sibcall-3.c fails on darwin with -m32 fxcoudert at gcc dot gnu.org
                   ` (10 preceding siblings ...)
  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
                   ` (12 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: dominiq at lps dot ens.fr @ 2015-02-21 12:51 UTC (permalink / raw)
  To: gcc-bugs

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

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |---

--- Comment #12 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
I cannot bootstrap with the patch in comment 5

/opt/gcc/build_w/./prev-gcc/xg++ -B/opt/gcc/build_w/./prev-gcc/
-B/opt/gcc/gcc4.10w/x86_64-apple-darwin14.1.0/bin/ -nostdinc++
-B/opt/gcc/build_w/prev-x86_64-apple-darwin14.1.0/libstdc++-v3/src/.libs
-B/opt/gcc/build_w/prev-x86_64-apple-darwin14.1.0/libstdc++-v3/libsupc++/.libs 
-I/opt/gcc/build_w/prev-x86_64-apple-darwin14.1.0/libstdc++-v3/include/x86_64-apple-darwin14.1.0
 -I/opt/gcc/build_w/prev-x86_64-apple-darwin14.1.0/libstdc++-v3/include 
-I/opt/gcc/work/libstdc++-v3/libsupc++
-L/opt/gcc/build_w/prev-x86_64-apple-darwin14.1.0/libstdc++-v3/src/.libs
-L/opt/gcc/build_w/prev-x86_64-apple-darwin14.1.0/libstdc++-v3/libsupc++/.libs
-c   -g -O2  -gtoggle -DIN_GCC    -fno-exceptions -fno-rtti
-fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings
-Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic
-Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Werror -fno-common
 -DHAVE_CONFIG_H -I. -I. -I../../work/gcc -I../../work/gcc/.
-I../../work/gcc/../include -I./../intl -I../../work/gcc/../libcpp/include
-I/opt/mp-new/include  -I../../work/gcc/../libdecnumber
-I../../work/gcc/../libdecnumber/dpd -I../libdecnumber
-I../../work/gcc/../libbacktrace -I/opt/mp-new/include  -o expmed.o -MT
expmed.o -MMD -MP -MF ./.deps/expmed.TPo ../../work/gcc/expmed.c
In file included from ../../work/gcc/emit-rtl.c:6337:0:
./gt-emit-rtl.h:339:2: internal compiler error: in
ipcp_verify_propagated_values, at ipa-cp.c:1057
 };
  ^

nor with the patch in comment 6: r220875 -> pr65150.


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [Bug target/63892] [5 Regression] gcc.dg/sibcall-3.c fails on darwin with -m32
  2014-11-15 16:21 [Bug target/63892] New: [5.0 regression] gcc.dg/sibcall-3.c fails on darwin with -m32 fxcoudert at gcc dot gnu.org
                   ` (11 preceding siblings ...)
  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
                   ` (11 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: iains at gcc dot gnu.org @ 2015-02-21 13:29 UTC (permalink / raw)
  To: gcc-bugs

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

Iain Sandoe <iains at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |iains at gcc dot gnu.org

--- Comment #13 from Iain Sandoe <iains at gcc dot gnu.org> ---
I have a fix in testing - will post to @patches shortly.


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [Bug target/63892] [5 Regression] gcc.dg/sibcall-3.c fails on darwin with -m32
  2014-11-15 16:21 [Bug target/63892] New: [5.0 regression] gcc.dg/sibcall-3.c fails on darwin with -m32 fxcoudert at gcc dot gnu.org
                   ` (12 preceding siblings ...)
  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
                   ` (10 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: iains at gcc dot gnu.org @ 2015-02-21 13:29 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #14 from Iain Sandoe <iains at gcc dot gnu.org> ---
https://gcc.gnu.org/ml/gcc-patches/2015-02/msg01320.html
(tested at r220887)

Looking at current output - recurser_void1 is sib-calling recurser_void2, but
not vice-versa.


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [Bug target/63892] [5 Regression] gcc.dg/sibcall-3.c fails on darwin with -m32
  2014-11-15 16:21 [Bug target/63892] New: [5.0 regression] gcc.dg/sibcall-3.c fails on darwin with -m32 fxcoudert at gcc dot gnu.org
                   ` (13 preceding siblings ...)
  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
                   ` (9 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: iains at gcc dot gnu.org @ 2015-02-21 14:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #15 from Iain Sandoe <iains at gcc dot gnu.org> ---

so .. in principle, if we are not creating an alias, it should not matter if
the target supports aliases or not.

I'm wondering if we're somehow deleting an alias that is used elsewhere in the
callgraph. I'm not sure if that's even possible (or if the remove() is supposed
to recompute / complain if the removed is still in use).


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [Bug target/63892] [5 Regression] gcc.dg/sibcall-3.c fails on darwin with -m32
  2014-11-15 16:21 [Bug target/63892] New: [5.0 regression] gcc.dg/sibcall-3.c fails on darwin with -m32 fxcoudert at gcc dot gnu.org
                   ` (14 preceding siblings ...)
  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
                   ` (8 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: iains at gcc dot gnu.org @ 2015-02-21 18:03 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #16 from Iain Sandoe <iains at gcc dot gnu.org> ---
The first error that comes up is a missing
std::__codecvt_utf8_base<char32_t>::do_unshift(__mbstate_t&, char*, char*,
char*&) [libstdc++ reference to itself]

===

And indeed, if prevent the redirect_callers for darwin (by putting in the &&
sem_item::target_supports_symbol_aliases_p ()), then we get:

nm -P x86_64-apple-darwin12/libstdc++-v3/src/c++11/codecvt.o |c++filt |grep
do_unshift
std::__codecvt_utf8_base<char32_t>::do_unshift(__mbstate_t&, char*, char*,
char*&) const T 1540 0
std::__codecvt_utf8_base<char16_t>::do_unshift(__mbstate_t&, char*, char*,
char*&) const T 1530 0
std::__codecvt_utf8_base<wchar_t>::do_unshift(__mbstate_t&, char*, char*,
char*&) const T 1550 0
std::__codecvt_utf16_base<char32_t>::do_unshift(__mbstate_t&, char*, char*,
char*&) const T 1570 0
std::__codecvt_utf16_base<char16_t>::do_unshift(__mbstate_t&, char*, char*,
char*&) const T 1560 0
std::__codecvt_utf16_base<wchar_t>::do_unshift(__mbstate_t&, char*, char*,
char*&) const T 1580 0
std::__codecvt_utf8_utf16_base<char32_t>::do_unshift(__mbstate_t&, char*,
char*, char*&) const T 1500 0
std::__codecvt_utf8_utf16_base<char16_t>::do_unshift(__mbstate_t&, char*,
char*, char*&) const T 1590 0
std::__codecvt_utf8_utf16_base<wchar_t>::do_unshift(__mbstate_t&, char*, char*,
char*&) const T 1f0 0
std::codecvt<char32_t, char, __mbstate_t>::do_unshift(__mbstate_t&, char*,
char*, char*&) const T 1520 0
std::codecvt<char16_t, char, __mbstate_t>::do_unshift(__mbstate_t&, char*,
char*, char*&) const T 1510 0

when that is removed:
$ nm -P codecvt.o |c++filt |grep do_unshift
std::__codecvt_utf8_base<char32_t>::do_unshift(__mbstate_t&, char*, char*,
char*&) const U 0 0
std::__codecvt_utf8_base<char16_t>::do_unshift(__mbstate_t&, char*, char*,
char*&) const U 0 0
std::__codecvt_utf8_base<wchar_t>::do_unshift(__mbstate_t&, char*, char*,
char*&) const U 0 0
std::__codecvt_utf16_base<char32_t>::do_unshift(__mbstate_t&, char*, char*,
char*&) const U 0 0
std::__codecvt_utf16_base<char16_t>::do_unshift(__mbstate_t&, char*, char*,
char*&) const U 0 0
std::__codecvt_utf16_base<wchar_t>::do_unshift(__mbstate_t&, char*, char*,
char*&) const U 0 0
std::__codecvt_utf8_utf16_base<char32_t>::do_unshift(__mbstate_t&, char*,
char*, char*&) const U 0 0
std::__codecvt_utf8_utf16_base<char16_t>::do_unshift(__mbstate_t&, char*,
char*, char*&) const U 0 0
std::__codecvt_utf8_utf16_base<wchar_t>::do_unshift(__mbstate_t&, char*, char*,
char*&) const T 1f0 0
std::codecvt<char32_t, char, __mbstate_t>::do_unshift(__mbstate_t&, char*,
char*, char*&) const U 0 0
std::codecvt<char16_t, char, __mbstate_t>::do_unshift(__mbstate_t&, char*,
char*, char*&) const U 0 0

===

So now to figure out what's missing from the conditions used to decide on
removal of the alias.


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [Bug target/63892] [5 Regression] gcc.dg/sibcall-3.c fails on darwin with -m32
  2014-11-15 16:21 [Bug target/63892] New: [5.0 regression] gcc.dg/sibcall-3.c fails on darwin with -m32 fxcoudert at gcc dot gnu.org
                   ` (15 preceding siblings ...)
  2015-02-21 18:03 ` iains at gcc dot gnu.org
@ 2015-02-22  4:59 ` iains at gcc dot gnu.org
  2015-02-22 13:10 ` iains at gcc dot gnu.org
                   ` (7 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: iains at gcc dot gnu.org @ 2015-02-22  4:59 UTC (permalink / raw)
  To: gcc-bugs

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)


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [Bug target/63892] [5 Regression] gcc.dg/sibcall-3.c fails on darwin with -m32
  2014-11-15 16:21 [Bug target/63892] New: [5.0 regression] gcc.dg/sibcall-3.c fails on darwin with -m32 fxcoudert at gcc dot gnu.org
                   ` (16 preceding siblings ...)
  2015-02-22  4:59 ` iains at gcc dot gnu.org
@ 2015-02-22 13:10 ` iains at gcc dot gnu.org
  2015-02-22 16:55 ` iains at gcc dot gnu.org
                   ` (6 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: iains at gcc dot gnu.org @ 2015-02-22 13:10 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="UTF-8", Size: 5001 bytes --]

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

--- Comment #18 from Iain Sandoe <iains at gcc dot gnu.org> ---

so - next increment - simplification of the previous. 
(don't try to redirect callers if we don't have any) 

diff --git a/gcc/ipa-icf.c b/gcc/ipa-icf.c
index e1af8bf..ca19967 100644
--- a/gcc/ipa-icf.c
+++ b/gcc/ipa-icf.c
@@ -660,7 +660,8 @@ sem_function::merge (sem_item *alias_item)
       /* When both alias and original are not overwritable, we can save
          the extra thunk wrapper for direct calls.  */
       redirect_callers
-       = (!original_discardable
+       = (alias->callers
+          && !original_discardable
           && !DECL_COMDAT_GROUP (alias->decl)
           && alias->get_availability () > AVAIL_INTERPOSABLE
           && original->get_availability () > AVAIL_INTERPOSABLE


Unfortunately, we're still not there.
I think that we can have a situation where we remove an alias which happens to
be the version that the vtable is pointing to (and so end up with an
unsatisfied reference from the vtable and link time).  

However, I still haven't figured out how to redirect those references…
>From gcc-bugs-return-478091-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sun Feb 22 13:04:44 2015
Return-Path: <gcc-bugs-return-478091-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 30159 invoked by alias); 22 Feb 2015 13:04:44 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 29981 invoked by uid 48); 22 Feb 2015 13:04:41 -0000
From: "zsojka at seznam dot cz" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/65161] ICE: in vec<_haifa_insn_data, va_heap, vl_embed>::operator[], at vec.h:736 with -O3 -fselective-scheduling2 -mtune=slm
Date: Sun, 22 Feb 2015 13:11:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: target
X-Bugzilla-Version: 5.0
X-Bugzilla-Keywords: ice-on-valid-code
X-Bugzilla-Severity: normal
X-Bugzilla-Who: zsojka at seznam dot cz
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: attachments.created
Message-ID: <bug-65161-4-uCSyeg3l04@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-65161-4@http.gcc.gnu.org/bugzilla/>
References: <bug-65161-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-02/txt/msg02423.txt.bz2
Content-length: 1917

https://gcc.gnu.org/bugzilla/show_bug.cgi?ide161

--- Comment #1 from Zdenek Sojka <zsojka at seznam dot cz> ---
Created attachment 34834
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id4834&actioníit
testcase that doesn't need --param on cmd line

Compiler output:
$ gcc -O3 -fselective-scheduling2 -mtune=slm testcase.c
testcase.c: In function 'foo':
testcase.c:11:1: internal compiler error: in operator[], at vec.h:736
 }
 ^
0x5abcde vec<_haifa_insn_data, va_heap, vl_embed>::operator[](unsigned int)
        /mnt/svn/gcc-trunk/gcc/vec.h:736
0xf304c6 vec<_haifa_insn_data, va_heap, vl_embed>::operator[](unsigned int)
        /mnt/svn/gcc-trunk/gcc/config/i386/i386.c:26672
0xf304c6 vec<_haifa_insn_data, va_heap, vl_ptr>::operator[](unsigned int)
        /mnt/svn/gcc-trunk/gcc/vec.h:1202
0xf304c6 swap_top_of_ready_list
        /mnt/svn/gcc-trunk/gcc/config/i386/i386.c:26661
0xf304c6 ix86_sched_reorder
        /mnt/svn/gcc-trunk/gcc/config/i386/i386.c:26740
0xc0e83d invoke_reorder_hooks
        /mnt/svn/gcc-trunk/gcc/sel-sched.c:4129
0xc0e83d find_best_expr
        /mnt/svn/gcc-trunk/gcc/sel-sched.c:4406
0xc0e83d fill_insns
        /mnt/svn/gcc-trunk/gcc/sel-sched.c:5568
0xc0f73a schedule_on_fences
        /mnt/svn/gcc-trunk/gcc/sel-sched.c:7393
0xc0f73a sel_sched_region_2
        /mnt/svn/gcc-trunk/gcc/sel-sched.c:7531
0xc11025 sel_sched_region_1
        /mnt/svn/gcc-trunk/gcc/sel-sched.c:7573
0xc11025 sel_sched_region(int)
        /mnt/svn/gcc-trunk/gcc/sel-sched.c:7674
0xc12021 run_selective_scheduling()
        /mnt/svn/gcc-trunk/gcc/sel-sched.c:7750
0xbea6e5 rest_of_handle_sched2
        /mnt/svn/gcc-trunk/gcc/sched-rgn.c:3647
0xbea6e5 execute
        /mnt/svn/gcc-trunk/gcc/sched-rgn.c:3791
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [Bug target/63892] [5 Regression] gcc.dg/sibcall-3.c fails on darwin with -m32
  2014-11-15 16:21 [Bug target/63892] New: [5.0 regression] gcc.dg/sibcall-3.c fails on darwin with -m32 fxcoudert at gcc dot gnu.org
                   ` (17 preceding siblings ...)
  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
                   ` (5 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: iains at gcc dot gnu.org @ 2015-02-22 16:55 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #19 from Iain Sandoe <iains at gcc dot gnu.org> ---
Created attachment 34836
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34836&action=edit
testcase to discuss.

So with the patch above, I get a failure to build LLVM stage#1.

the .ii here is a reduced case.

TBH , I'm not sure what to make of this - on a debugging stage#1 compiler on
Darwin (only need a cc1plus).

gcc/cc1plus -fpreprocessed t.ii -fPIC -quiet -dumpbase t.ii
-mmacosx-version-min=10.8.6 -mtune=core2 -auxbase t -O2 -std=c++11 -version -o
t.s

====
I'm not understanding why getAnalysisUsage() is saying it's called by
addEscapingUse() and vice-versa … that's not what the source says.

Is this because the bodies of the functions are equivalent (i.e. both empty)?

In which case I guess the referring pointers need to be moved to the original
before the alias is deleted… not 100% sure how to do that .. 

---

Breakpoint 2, ipa_icf::sem_function::merge (this=0x142a21660,
alias_item=0x142a21860) at /GCC/gcc-trunk/gcc/ipa-icf.c:734
734        alias->remove ();
(gdb) p alias->debug()
_ZNK12_GLOBAL__N_14NoAA16getAnalysisUsageERN4llvm13AnalysisUsageE/9 (virtual
void {anonymous}::NoAA::getAnalysisUsage(llvm::AnalysisUsage&) const)
@0x143969310
  Type: function definition analyzed
  Visibility: prevailing_def_ironly virtual
  Address is taken.
  References: 
  Referring: _ZTVN12_GLOBAL__N_14NoAAE/17 (addr)
  Availability: available
  First run: 0
  Function flags: body icf_merged
  Called by: 
  Calls: 
$1 = void
Current language:  auto; currently c++
(gdb) p original->debug()
_ZN12_GLOBAL__N_14NoAA14addEscapingUseERN4llvm3UseE/11 (virtual void
{anonymous}::NoAA::addEscapingUse(llvm::Use&)) @0x143975188
  Type: function definition analyzed
  Visibility: prevailing_def_ironly virtual
  Address is taken.
  References: 
  Referring: _ZTVN12_GLOBAL__N_14NoAAE/17 (addr)
  Availability: available
  First run: 0
  Function flags: body
  Called by:
_ZThn8_NK12_GLOBAL__N_14NoAA16getAnalysisUsageERN4llvm13AnalysisUsageE/10 (1.00
per call) _ZThn8_N12_GLOBAL__N_14NoAA14addEscapingUseERN4llvm3UseE/12 (1.00 per
call) 
  Calls: 
$2 = void
(gdb) p local_original->debug()
_ZN12_GLOBAL__N_14NoAA14addEscapingUseERN4llvm3UseE/11 (virtual void
{anonymous}::NoAA::addEscapingUse(llvm::Use&)) @0x143975188
  Type: function definition analyzed
  Visibility: prevailing_def_ironly virtual
  Address is taken.
  References: 
  Referring: _ZTVN12_GLOBAL__N_14NoAAE/17 (addr)
  Availability: available
  First run: 0
  Function flags: body
  Called by:
_ZThn8_NK12_GLOBAL__N_14NoAA16getAnalysisUsageERN4llvm13AnalysisUsageE/10 (1.00
per call) _ZThn8_N12_GLOBAL__N_14NoAA14addEscapingUseERN4llvm3UseE/12 (1.00 per
call) 
  Calls: 
$3 = void
>From gcc-bugs-return-478106-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sun Feb 22 16:51:47 2015
Return-Path: <gcc-bugs-return-478106-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 6032 invoked by alias); 22 Feb 2015 16:51:46 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 5718 invoked by uid 48); 22 Feb 2015 16:51:42 -0000
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 17:06:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: target
X-Bugzilla-Version: 5.0
X-Bugzilla-Keywords: wrong-code
X-Bugzilla-Severity: normal
X-Bugzilla-Who: iains at gcc dot gnu.org
X-Bugzilla-Status: REOPENED
X-Bugzilla-Priority: P2
X-Bugzilla-Assigned-To: marxin at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 5.0
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-63892-4-OnxtcGjXjs@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-63892-4@http.gcc.gnu.org/bugzilla/>
References: <bug-63892-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-02/txt/msg02438.txt.bz2
Content-length: 1050

https://gcc.gnu.org/bugzilla/show_bug.cgi?idc892

--- Comment #20 from Iain Sandoe <iains at gcc dot gnu.org> ---
testing:
diff --git a/gcc/ipa-icf.c b/gcc/ipa-icf.c
index e1af8bf..4d72e42 100644
--- a/gcc/ipa-icf.c
+++ b/gcc/ipa-icf.c
@@ -660,7 +660,8 @@ sem_function::merge (sem_item *alias_item)
       /* When both alias and original are not overwritable, we can save
          the extra thunk wrapper for direct calls.  */
       redirect_callers
-       = (!original_discardable
+       = (alias->callers
+          && !original_discardable
           && !DECL_COMDAT_GROUP (alias->decl)
           && alias->get_availability () > AVAIL_INTERPOSABLE
           && original->get_availability () > AVAIL_INTERPOSABLE
@@ -724,7 +725,7 @@ sem_function::merge (sem_item *alias_item)

       /* The alias function is removed if symbol address
          does not matter.  */
-      if (!alias_address_matters)
+      if (!alias_address_matters && alias->ref_list.referring.is_empty())
        alias->remove ();

       if (dump_file && redirected)


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [Bug target/63892] [5 Regression] gcc.dg/sibcall-3.c fails on darwin with -m32
  2014-11-15 16:21 [Bug target/63892] New: [5.0 regression] gcc.dg/sibcall-3.c fails on darwin with -m32 fxcoudert at gcc dot gnu.org
                   ` (18 preceding siblings ...)
  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
                   ` (4 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: howarth at bromo dot med.uc.edu @ 2015-02-22 22:27 UTC (permalink / raw)
  To: gcc-bugs

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

howarth at bromo dot med.uc.edu changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |howarth at bromo dot med.uc.edu

--- Comment #21 from howarth at bromo dot med.uc.edu ---
(In reply to Iain Sandoe from comment #20)

This change seems to be regressing...

FAIL: gcc.dg/attr-noinline.c scan-assembler function_definition
FAIL: gcc.dg/attr-noinline.c scan-assembler function_declaration_both_before
FAIL: gcc.dg/attr-noinline.c scan-assembler function_declaration_both_after
FAIL: gcc.dg/attr-noinline.c scan-assembler
function_declaration_noinline_before
FAIL: gcc.dg/attr-noinline.c scan-assembler function_declaration_noinline_after
FAIL: gcc.dg/attr-noinline.c scan-assembler function_declaration_inline_before
FAIL: gcc.dg/attr-noinline.c scan-assembler
function_declaration_inline_noinline_before
FAIL: gcc.dg/attr-noinline.c scan-assembler
function_declaration_inline_noinline_after


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [Bug target/63892] [5 Regression] gcc.dg/sibcall-3.c fails on darwin with -m32
  2014-11-15 16:21 [Bug target/63892] New: [5.0 regression] gcc.dg/sibcall-3.c fails on darwin with -m32 fxcoudert at gcc dot gnu.org
                   ` (19 preceding siblings ...)
  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
                   ` (3 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: iains at gcc dot gnu.org @ 2015-02-22 23:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #22 from Iain Sandoe <iains at gcc dot gnu.org> ---
yeah, it's not right yet.. looking at this:
diff --git a/gcc/ipa-icf.c b/gcc/ipa-icf.c
index e1af8bf..3b5553e 100644
--- a/gcc/ipa-icf.c
+++ b/gcc/ipa-icf.c
@@ -658,13 +658,16 @@ sem_function::merge (sem_item *alias_item)
       create_thunk = !stdarg_p (TREE_TYPE (alias->decl));
       create_alias = false;
       /* When both alias and original are not overwritable, we can save
-         the extra thunk wrapper for direct calls.  */
+         the extra thunk wrapper for direct calls (providing that there
+         are no other referring entries).  */
       redirect_callers
        = (!original_discardable
           && !DECL_COMDAT_GROUP (alias->decl)
           && alias->get_availability () > AVAIL_INTERPOSABLE
           && original->get_availability () > AVAIL_INTERPOSABLE
-          && !alias->instrumented_version);
+          && !alias->instrumented_version
+          && alias->ref_list.referring.is_empty()
+         );
     }
   else
     {


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [Bug target/63892] [5 Regression] gcc.dg/sibcall-3.c fails on darwin with -m32
  2014-11-15 16:21 [Bug target/63892] New: [5.0 regression] gcc.dg/sibcall-3.c fails on darwin with -m32 fxcoudert at gcc dot gnu.org
                   ` (20 preceding siblings ...)
  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
                   ` (2 subsequent siblings)
  24 siblings, 0 replies; 26+ messages in thread
From: iains at gcc dot gnu.org @ 2015-02-23  8:45 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #23 from Iain Sandoe <iains at gcc dot gnu.org> ---
(In reply to Iain Sandoe from comment #22)
> yeah, it's not right yet.. looking at this:
> diff --git a/gcc/ipa-icf.c b/gcc/ipa-icf.c
> index e1af8bf..3b5553e 100644
> --- a/gcc/ipa-icf.c
> +++ b/gcc/ipa-icf.c
> @@ -658,13 +658,16 @@ sem_function::merge (sem_item *alias_item)
>        create_thunk = !stdarg_p (TREE_TYPE (alias->decl));
>        create_alias = false;
>        /* When both alias and original are not overwritable, we can save
> -         the extra thunk wrapper for direct calls.  */
> +         the extra thunk wrapper for direct calls (providing that there
> +         are no other referring entries).  */
>        redirect_callers
>         = (!original_discardable
>            && !DECL_COMDAT_GROUP (alias->decl)
>            && alias->get_availability () > AVAIL_INTERPOSABLE
>            && original->get_availability () > AVAIL_INTERPOSABLE
> -          && !alias->instrumented_version);
> +          && !alias->instrumented_version
> +          && alias->ref_list.referring.is_empty()
> +         );
>      }
>    else
>      {

so overnight testing shows that this regresses iinline-5.c on Linux (the
generated asm is the same barring label names, and the exe runs, but the dump
scan fails).

However, it completely trashes Java (on Darwin only) so 
(a) there appears to be some Java code-gen that needs functions marked as
virtual, externally-visible, but with no callers and no referrers)… needs some
debugging.

(b) Under what circumstances is it correct to remove an alias that has
referrers? (since Linux seems to be doing that, and fails the iinline-5.c test
without).

( c) there are other C/C++ test regressions on Darwin still - so more debugging
is needed.
>From gcc-bugs-return-478138-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Mon Feb 23 08:42:56 2015
Return-Path: <gcc-bugs-return-478138-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 22884 invoked by alias); 23 Feb 2015 08:42:56 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 22822 invoked by uid 48); 23 Feb 2015 08:42:52 -0000
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/65032] [5 Regression] ICE in reload_combine_note_use, at postreload.c:1556 on i686-linux-gnu
Date: Mon, 23 Feb 2015 08:52:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: target
X-Bugzilla-Version: 5.0
X-Bugzilla-Keywords: ice-on-valid-code
X-Bugzilla-Severity: normal
X-Bugzilla-Who: jakub at gcc dot gnu.org
X-Bugzilla-Status: NEW
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 5.0
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-65032-4-nIaRb2h835@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-65032-4@http.gcc.gnu.org/bugzilla/>
References: <bug-65032-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-02/txt/msg02470.txt.bz2
Content-length: 140

https://gcc.gnu.org/bugzilla/show_bug.cgi?ide032

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Started with r220060.


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [Bug target/63892] [5 Regression] gcc.dg/sibcall-3.c fails on darwin with -m32
  2014-11-15 16:21 [Bug target/63892] New: [5.0 regression] gcc.dg/sibcall-3.c fails on darwin with -m32 fxcoudert at gcc dot gnu.org
                   ` (21 preceding siblings ...)
  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
  24 siblings, 0 replies; 26+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-02-23 11:15 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #25 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
The regression is tracked as PR65150, so I'm closing this PR.


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [Bug target/63892] [5 Regression] gcc.dg/sibcall-3.c fails on darwin with -m32
  2014-11-15 16:21 [Bug target/63892] New: [5.0 regression] gcc.dg/sibcall-3.c fails on darwin with -m32 fxcoudert at gcc dot gnu.org
                   ` (22 preceding siblings ...)
  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
  24 siblings, 0 replies; 26+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-02-23 11:15 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #24 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
As written right now, redirect_callers case doesn't have a fallthru into the
create_thunk case, i.e. we have to redirect all callers (and all other
references to it, but the latter we don't handle right now) and then thunk
won't be created.  So, the question is what test to add there to
redirect_callers setting, or if we could change not just callers, but other
references too.
Perhaps just adding !DECL_VIRTUAL_P (alias->decl) could do the job.  Or, do we
have vtable references also to non-DECL_VIRTUAL_P functions?


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [Bug target/63892] [5 Regression] gcc.dg/sibcall-3.c fails on darwin with -m32
  2014-11-15 16:21 [Bug target/63892] New: [5.0 regression] gcc.dg/sibcall-3.c fails on darwin with -m32 fxcoudert at gcc dot gnu.org
                   ` (23 preceding siblings ...)
  2015-02-23 11:15 ` jakub at gcc dot gnu.org
@ 2015-02-27  7:44 ` mrs at gcc dot gnu.org
  24 siblings, 0 replies; 26+ messages in thread
From: mrs at gcc dot gnu.org @ 2015-02-27  7:44 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63892
Bug 63892 depends on bug 65150, which changed state.

Bug 65150 Summary: [5 Regression] r220875 causes bootstrap failure on x86_64 darwin
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65150

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED


^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2015-02-27  5:52 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-15 16:21 [Bug target/63892] New: [5.0 regression] gcc.dg/sibcall-3.c fails on darwin with -m32 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
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

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).