public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Indu Bhagat <indu.bhagat@oracle.com>
To: gcc-patches@gcc.gnu.org
Subject: [PATCH 1/3] ctfc: get rid of the static variable in ctf_list_add_ctf_vars ()
Date: Wed, 30 Mar 2022 16:31:33 -0700	[thread overview]
Message-ID: <20220330233135.1762317-2-indu.bhagat@oracle.com> (raw)
In-Reply-To: <20220330233135.1762317-1-indu.bhagat@oracle.com>

2022-03-28  Indu Bhagat  <indu.bhagat@oracle.com>

gcc/ChangeLog:

	* ctfc.h (struct ctf_container): Introduce a new member.
	* ctfout.cc (ctf_list_add_ctf_vars): Use it instead of static
	  variable.
---
 gcc/ctfc.h    | 2 ++
 gcc/ctfout.cc | 4 +---
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/gcc/ctfc.h b/gcc/ctfc.h
index 18c93c802a06..4ce756c728a7 100644
--- a/gcc/ctfc.h
+++ b/gcc/ctfc.h
@@ -301,6 +301,8 @@ typedef struct GTY (()) ctf_container
   /* List of pre-processed CTF Variables.  CTF requires that the variables
      appear in the sorted order of their names.  */
   ctf_dvdef_t ** GTY ((length ("0"))) ctfc_vars_list;
+  /* Count of pre-processed CTF Variables in the list.  */
+  uint64_t ctfc_vars_list_count;
   /* List of pre-processed CTF types.  CTF requires that a shared type must
      appear before the type that uses it.  For the compiler, this means types
      are emitted in sorted order of their type IDs.  */
diff --git a/gcc/ctfout.cc b/gcc/ctfout.cc
index a23d37758019..28a873b2027d 100644
--- a/gcc/ctfout.cc
+++ b/gcc/ctfout.cc
@@ -173,9 +173,7 @@ ctf_calc_num_vbytes (ctf_dtdef_ref ctftype)
 static void
 ctf_list_add_ctf_vars (ctf_container_ref ctfc, ctf_dvdef_ref var)
 {
-  /* FIXME - static may not fly with multiple CUs.  */
-  static int num_vars_added = 0;
-  ctfc->ctfc_vars_list[num_vars_added++] = var;
+  ctfc->ctfc_vars_list[ctfc->ctfc_vars_list_count++] = var;
 }
 
 /* Initialize the various sections and labels for CTF output.  */
-- 
2.31.1


  reply	other threads:[~2022-03-30 23:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-30 23:31 [PATCH 0/3] Fix PR debug/105089 Indu Bhagat
2022-03-30 23:31 ` Indu Bhagat [this message]
2022-03-30 23:31 ` [PATCH 2/3] CTF for extern variable fix [PR105089] Indu Bhagat
2022-03-30 23:31 ` [PATCH 3/3] Refactor and update CTF testcases [PR105089] Indu Bhagat
2022-04-07 20:04 ` [PATCH 0/3] Fix PR debug/105089 Indu Bhagat
2022-04-08  6:37   ` Richard Biener

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=20220330233135.1762317-2-indu.bhagat@oracle.com \
    --to=indu.bhagat@oracle.com \
    --cc=gcc-patches@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).