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/61886] [4.8/4.9/4.10 Regression] LTO breaks fread with _FORTIFY_SOURCE=2
Date: Wed, 23 Jul 2014 10:58:00 -0000	[thread overview]
Message-ID: <bug-61886-4-3WJW36kcJ7@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-61886-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Btw, it seems that at the point we merge in lto-symtab.c the cgraph nodes are
not yet populated.  Neither of the two candidates are marked as alias.

So maybe the wrong thing already happens earlier, during compile-time
and we shouldn't do any symtab merging?  at least from symbols originating
from the same TU?  That is, tree merging already should catch most
true equivalencies and cgraph merging shouldn't be symtab-driven?

That said, I wonder how to fix things up properly.

The following fixes the testcase, not merging the actual symtab intra-TU
and retaining decls that have a symtab entry recorded.

Index: gcc/lto/lto-symtab.c
===================================================================
--- gcc/lto/lto-symtab.c        (revision 212927)
+++ gcc/lto/lto-symtab.c        (working copy)
@@ -575,6 +575,9 @@ lto_symtab_merge_symbols_1 (symtab_node

       if (!lto_symtab_symbol_p (e))
        continue;
+      /* Do not merge symtab nodes originating from the same TU.  */
+      if (e->lto_file_data == prevailing->lto_file_data)
+       continue;
       cgraph_node *ce = dyn_cast <cgraph_node *> (e);
       if (ce && !DECL_BUILT_IN (e->decl))
        lto_cgraph_replace_node (ce, cgraph (prevailing));
@@ -680,6 +683,12 @@ lto_symtab_prevailing_decl (tree decl)
   if (TREE_CODE (decl) == FUNCTION_DECL && DECL_BUILT_IN (decl))
     return decl;

+  /* If the decl retained its symtab node then it prevails.  This
+     preserves semantically different decls for the same underlying
+     symbol, like aliases that have been resolved at compile-time.  */
+  if (symtab_get_node (decl))
+    return decl;
+
   /* Ensure DECL_ASSEMBLER_NAME will not set assembler name.  */
   gcc_assert (DECL_ASSEMBLER_NAME_SET_P (decl));


       reply	other threads:[~2014-07-23 10:58 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-61886-4@http.gcc.gnu.org/bugzilla/>
2014-07-23 10:58 ` rguenth at gcc dot gnu.org [this message]
2014-07-23 11:13 ` rguenth at gcc dot gnu.org
2014-07-23 13:08 ` rguenth at gcc dot gnu.org
2014-07-23 13:37 ` hubicka at gcc dot gnu.org
2014-08-27 10:00 ` [Bug lto/61886] [4.8/4.9/5 " rguenth at gcc dot gnu.org
2014-08-27 14:51 ` hubicka at ucw dot cz
2014-08-28  8:20 ` rguenther at suse dot de
2014-09-08  0:42 ` hubicka at ucw dot cz
2014-09-08  7:53 ` rguenther at suse dot de
2014-10-06 20:23 ` hubicka at ucw dot cz
2014-10-06 20:34 ` jakub at redhat dot com
2014-10-06 22:08 ` jakub at redhat dot com
2014-10-06 22:19 ` hubicka at ucw dot cz
2014-10-06 22:38 ` jakub at redhat dot com
2014-10-06 22:44 ` hubicka at ucw dot cz
2014-10-07  5:46 ` hubicka at ucw dot cz
2014-10-07  9:24 ` jakub at gcc dot gnu.org
2014-10-07  9:35 ` jakub at gcc dot gnu.org
2014-10-07 19:49 ` hubicka at ucw dot cz
2014-10-08  7:37 ` rguenther at suse dot de
2014-10-08  8:25 ` jakub at gcc dot gnu.org
2014-10-08 10:42 ` rguenther at suse dot de
2014-10-08 17:49 ` hubicka at ucw dot cz
2014-12-01 12:31 ` rguenth at gcc dot gnu.org
2014-12-19 13:37 ` jakub at gcc dot gnu.org
2015-01-19 13:16 ` rguenth at gcc dot gnu.org
2015-02-11  8:29 ` rguenth at gcc dot gnu.org
2015-02-11  8:33 ` rguenth at gcc dot gnu.org
2015-02-11  9:15 ` hubicka at ucw dot cz
2015-02-11 10:05 ` rguenther at suse dot de
2015-02-11 16:30 ` zackw at panix dot com
2015-03-03 19:12 ` hubicka at gcc dot gnu.org
2015-03-20 21:00 ` hubicka at gcc dot gnu.org
2015-06-23  8:21 ` [Bug lto/61886] [4.8/4.9/5/6 " rguenth at gcc dot gnu.org
2015-06-26 20:10 ` [Bug lto/61886] [4.9/5/6 " jakub at gcc dot gnu.org
2015-06-26 20:35 ` jakub 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-61886-4-3WJW36kcJ7@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).