public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Check whether the global variable has been modified in a function or some blocks
@ 2023-09-29 15:49 Hanke Zhang
  0 siblings, 0 replies; only message in thread
From: Hanke Zhang @ 2023-09-29 15:49 UTC (permalink / raw)
  To: gcc

Hi, I have recently been working on issues related to the changing
values of global variables. That is, I was trying to develop a gimple
pass, which needs to check whether the value of a global variable is
modified in the a function or some blocks.

Some of the more tricky cases are as follows:

int type; // global variable
void foo() {
  int tmp;
  tmp = type; // store type in tmp
  type = 0;
  // do other things
  // type will be used or changed
  // ...
  type = tmp;
  return;
}

Obviously, this function does not modify the value of type, but from
the compiler's point of view, it seems not so obvious. I'd like to ask
is there any good way to solve it? Or does gcc provide some ready-made
implementations to use already?

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-09-29 15:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-29 15:49 Check whether the global variable has been modified in a function or some blocks Hanke Zhang

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).