public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/29299] [4.2 Regresion] gcc "used" attribute has no effect on local-scope static variables
Date: Mon, 09 Oct 2006 13:05:00 -0000	[thread overview]
Message-ID: <20061009130455.9697.qmail@sourceware.org> (raw)
In-Reply-To: <bug-29299-13334@http.gcc.gnu.org/bugzilla/>



------- Comment #4 from rguenth at gcc dot gnu dot org  2006-10-09 13:04 -------
We have

bool
decide_is_variable_needed (struct cgraph_varpool_node *node, tree decl)
{
  /* If the user told us it is used, then it must be so.  */
  if (node->externally_visible || node->force_output)
    return true;
  if (!flag_unit_at_a_time
      && lookup_attribute ("used", DECL_ATTRIBUTES (decl)))
    return true;

with "used" set on bar...

Now, the handler for attribute "used" sets DECL_PRESERVE_P on the decl, so
we might as well check that.

Index: cgraph.c
===================================================================
*** cgraph.c    (revision 117569)
--- cgraph.c    (working copy)
*************** bool
*** 939,948 ****
  decide_is_variable_needed (struct cgraph_varpool_node *node, tree decl)
  {
    /* If the user told us it is used, then it must be so.  */
!   if (node->externally_visible || node->force_output)
!     return true;
!   if (!flag_unit_at_a_time
!       && lookup_attribute ("used", DECL_ATTRIBUTES (decl)))
      return true;

    /* ??? If the assembler name is set by hand, it is possible to assemble
--- 939,947 ----
  decide_is_variable_needed (struct cgraph_varpool_node *node, tree decl)
  {
    /* If the user told us it is used, then it must be so.  */
!   if (node->externally_visible
!       || node->force_output
!       || DECL_PRESERVE_P (decl))
      return true;

    /* ??? If the assembler name is set by hand, it is possible to assemble


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |rguenth at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2006-09-30 19:40:21         |2006-10-09 13:04:55
               date|                            |


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


  parent reply	other threads:[~2006-10-09 13:05 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-30 15:00 [Bug c/29299] New: " jeremy at goop dot org
2006-09-30 16:04 ` [Bug c/29299] " pinskia at gcc dot gnu dot org
2006-09-30 16:46 ` jeremy at goop dot org
2006-09-30 19:40 ` [Bug middle-end/29299] [4.2 Regresion] " pinskia at gcc dot gnu dot org
2006-10-01 23:06 ` mmitchel at gcc dot gnu dot org
2006-10-09 13:05 ` rguenth at gcc dot gnu dot org [this message]
2006-10-15 16:34 ` pinskia at gcc dot gnu dot org
2006-10-15 17:03 ` rguenth at gcc dot gnu dot org
2006-10-15 17:32 ` pinskia at gcc dot gnu dot org
2006-10-15 22:33 ` [Bug middle-end/29299] [4.2 Regression] " hubicka at ucw dot cz
2006-10-18 21:40 ` hubicka at gcc dot gnu dot org
2006-10-18 21:54 ` hubicka at gcc dot gnu dot org
2007-06-26 11:52 ` jakub at gcc dot gnu dot 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=20061009130455.9697.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).