public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "hubicka at ucw dot cz" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/28744] externally_visible attribute not effective with prior declaration of symbol.
Date: Sun, 20 Aug 2006 13:12:00 -0000	[thread overview]
Message-ID: <20060820131209.13835.qmail@sourceware.org> (raw)
In-Reply-To: <bug-28744-9416@http.gcc.gnu.org/bugzilla/>



------- Comment #14 from hubicka at ucw dot cz  2006-08-20 13:12 -------
Subject: Re:  externally_visible attribute not effective with prior declaration
of symbol.

Hi,
this is patch I am testing now.  Can you think of way to break it
(again? :))
The whole thing is a lot more sliperly than I would like it to be...

Honza

Index: cgraphunit.c
===================================================================
*** cgraphunit.c        (revision 116257)
--- cgraphunit.c        (working copy)
*************** cgraph_analyze_function (struct cgraph_n
*** 965,975 ****
     is valid.

     So, we walk the nodes at the end of the translation unit, applying the
!    attributes at that point.  */

  static void
  process_function_and_variable_attributes (struct cgraph_node *first,
!                                           struct cgraph_varpool_node
*first_var)
  {
    struct cgraph_node *node;
    struct cgraph_varpool_node *vnode;
--- 985,1002 ----
     is valid.

     So, we walk the nodes at the end of the translation unit, applying the
!    attributes at that point. 
!    
!    The local variables needs to be walked on the end of each compilation unit
!    (to allow dead function/variable removal), while the global variables
needs
!    to be handled on the end of compilation to allow flags to be declared only
!    in one of units.  The GLOBAL is used to specify whether local or global
!    variables shall be processed.  */

  static void
  process_function_and_variable_attributes (struct cgraph_node *first,
!                                           struct cgraph_varpool_node
*first_var,
!                                         bool global)
  {
    struct cgraph_node *node;
    struct cgraph_varpool_node *vnode;
*************** process_function_and_variable_attributes
*** 977,982 ****
--- 1004,1012 ----
    for (node = cgraph_nodes; node != first; node = node->next)
      {
        tree decl = node->decl;
+       if (global != (DECL_COMDAT (decl)
+                    || (TREE_PUBLIC (decl) && !DECL_EXTERNAL (decl))))
+       continue;
        if (lookup_attribute ("used", DECL_ATTRIBUTES (decl)))
        {
          mark_decl_referenced (decl);
*************** process_function_and_variable_attributes
*** 1000,1005 ****
--- 1030,1037 ----
    for (vnode = cgraph_varpool_nodes; vnode != first_var; vnode = vnode->next)
      {
        tree decl = vnode->decl;
+       if (global != (DECL_COMDAT (decl) || TREE_PUBLIC (decl)))
+       continue;
        if (lookup_attribute ("used", DECL_ATTRIBUTES (decl)))
        {
          mark_decl_referenced (decl);
*************** cgraph_finalize_compilation_unit (void)
*** 1052,1058 ****
      }

    timevar_push (TV_CGRAPH);
!   process_function_and_variable_attributes (first_analyzed,
first_analyzed_var);
    cgraph_varpool_analyze_pending_decls ();
    if (cgraph_dump_file)
      {
--- 1085,1092 ----
      }

    timevar_push (TV_CGRAPH);
!   process_function_and_variable_attributes (first_analyzed,
first_analyzed_var,
!                                           false);
    cgraph_varpool_analyze_pending_decls ();
    if (cgraph_dump_file)
      {
*************** cgraph_optimize (void)
*** 1505,1512 ****

    timevar_push (TV_CGRAPHOPT);
    if (!quiet_flag)
!     fprintf (stderr, "Performing intraprocedural optimizations\n");

    cgraph_function_and_variable_visibility ();
    if (cgraph_dump_file)
      {
--- 1540,1548 ----

    timevar_push (TV_CGRAPHOPT);
    if (!quiet_flag)
!     fprintf (stderr, "Performing interprocedural optimizations\n");

+   process_function_and_variable_attributes (NULL, NULL, true);
    cgraph_function_and_variable_visibility ();
    if (cgraph_dump_file)
      {


-- 


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


  parent reply	other threads:[~2006-08-20 13:12 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-15 20:01 [Bug c/28744] New: " dwmw2 at infradead dot org
2006-08-15 20:06 ` [Bug c/28744] " jakub at gcc dot gnu dot org
2006-08-15 21:04 ` pinskia at gcc dot gnu dot org
2006-08-15 21:08 ` pinskia at gcc dot gnu dot org
2006-08-15 21:18 ` jakub at gcc dot gnu dot org
2006-08-16 10:23 ` jakub at gcc dot gnu dot org
2006-08-16 13:17 ` jakub at gcc dot gnu dot org
2006-08-16 18:11 ` dwmw2 at infradead dot org
2006-08-17  9:16 ` dwmw2 at infradead dot org
2006-08-17 11:52 ` jakub at gcc dot gnu dot org
2006-08-17 12:20 ` jakub at gcc dot gnu dot org
2006-08-18 11:12 ` dwmw2 at infradead dot org
2006-08-20 12:42 ` hubicka at ucw dot cz
2006-08-20 12:53 ` aldot at gcc dot gnu dot org
2006-08-20 12:59 ` hubicka at ucw dot cz
2006-08-20 13:12 ` hubicka at ucw dot cz [this message]
2006-08-20 13:15 ` aldot at gcc dot gnu dot org
2006-10-06 11:45 ` jakub at gcc dot gnu dot org
2008-01-15 18:09 ` alexandre dot nunes at gmail dot com
     [not found] <bug-28744-4@http.gcc.gnu.org/bugzilla/>
2012-03-24 22:10 ` hubicka 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=20060820131209.13835.qmail@sourceware.org \
    --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).