public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug lto/50601] [4.7 Regression] New LTO failures
Date: Tue, 06 Dec 2011 11:35:00 -0000	[thread overview]
Message-ID: <bug-50601-4-RG8TZbQnPv@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-50601-4@http.gcc.gnu.org/bugzilla/>

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50601

--- Comment #6 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-12-06 11:34:41 UTC ---
Because the decl isn't considered decl_address_invariant_p () - of course,
it is neither TREE_STATIC nor DECL_EXTERNAL ...

It _is_ both TREE_PUBLIC and TREE_STATIC when created by the C++ frontend
(and during compile stage).

We get

2
cp_lto_20100302_0.o 4
164 6cc97232062f75e0 PREVAILING_DEF_IRONLY _Z1fPU8__vectorf
177 6cc97232062f75e0 PREVAILING_DEF_IRONLY _Z1fPDv4_f
180 6cc97232062f75e0 PREVAILING_DEF_IRONLY _ZN1AIDv4_fE1tE
182 6cc97232062f75e0 PREVAILING_DEF_IRONLY _ZN1AIU8__vectorfE1tE
cp_lto_20100302_1.o 3
164 5d25700523736b18 PREVAILING_DEF main
168 5d25700523736b18 RESOLVED_IR _Z1fPDv4_f
179 5d25700523736b18 RESOLVED_IR _ZN1AIDv4_fE1tE

which is then mangled via cgraph_make_decl_local during the IPA
function and variable visibility pass.  This removes the TREE_PUBLIC
flag, the TREE_STATIC flag remains at WPA stage.  Note that the
parent, non-alias decl stays TREE_PUBLIC.

The no longer TREE_PUBLIC alias is then mangled at LTRANS stage, and
the TREE_STATIC flag is cleared in:

input_varpool_node (file_data=0x7ffff5b61000, ib=0x19ec4f0)
    at /space/rguenther/src/svn/trunk/gcc/lto-cgraph.c:1083
1083      if (node->finalized)
(gdb) l
1078      if (node->in_other_partition)
1079        {
1080          DECL_EXTERNAL (node->decl) = 1;
1081          TREE_STATIC (node->decl) = 0;
1082        }

but DECL_EXTERNAL is in turn cleared again by

assemble_alias (decl=0x7ffff5a2c140, target=0x7ffff5b5af00)
    at /space/rguenther/src/svn/trunk/gcc/varasm.c:5850
5850      if (TREE_CODE (decl) == FUNCTION_DECL)
(gdb) l
5845         note that the symbol is in fact locally defined.  */
5846      if (! is_weakref)
5847        DECL_EXTERNAL (decl) = 0;

that, of course, looks bogus in the light of LTO partitioning.  Doing

  /* A quirk of the initial implementation of aliases required that the user
     add "extern" to all of them.  Which is silly, but now historical.  Do
     note that the symbol is in fact locally defined.  */
  if (! is_weakref
      && (TREE_CODE (decl) == FUNCTION_DECL
          || !varpool_node (decl)->in_other_partition))
    DECL_EXTERNAL (decl) = 0;

instead "fixes" this bug.


  parent reply	other threads:[~2011-12-06 11:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-03 16:39 [Bug lto/50601] New: " hjl.tools at gmail dot com
2011-10-03 16:42 ` [Bug lto/50601] " hjl.tools at gmail dot com
2011-10-10 15:17 ` rguenth at gcc dot gnu.org
2011-11-14 18:47 ` hjl.tools at gmail dot com
2011-12-06 10:57 ` rguenth at gcc dot gnu.org
2011-12-06 11:04 ` rguenth at gcc dot gnu.org
2011-12-06 11:35 ` rguenth at gcc dot gnu.org [this message]
2011-12-06 13:27 ` rguenth at gcc dot gnu.org
2011-12-06 13:29 ` rguenth at gcc dot gnu.org
2011-12-07 13:34 ` rguenth 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-50601-4-RG8TZbQnPv@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).