public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Save/Store information, which variable are not initialized
@ 2022-03-04 16:06 Sławomir Lach
  0 siblings, 0 replies; only message in thread
From: Sławomir Lach @ 2022-03-04 16:06 UTC (permalink / raw)
  To: gcc

I known, IDE will detect cases, whereas variable is not initialized, but some 
developers still have problems with variable initialization.

I suppose gcc do not support any run-time sanitizer, because I do not found 
any information.

So: gcc will introduce hidden array of variables for each context. One bit 
stores information about one variable in current scope. So, if it is set - 
variable was initialized. In other case, variable is not initialized. When new 
scope is created, gcc will allocate this array and set each element to 0. When 
program set variable, also bit is set.

Each structure will contains this array at top of self. GCC must hack access 
to this struct in some way. That is big problem to handle this case, because 
some languages allow to free memory access. Maybe for struct store information 
about fields state in different part of memory?

Idea was inspired by way to detect cases, where return address was written.
Programmer should compile program with special switch to enable this mode.

GDB could support this feature of gcc and read, which variable was not set.



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

only message in thread, other threads:[~2022-03-04 16:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-04 16:06 Save/Store information, which variable are not initialized Sławomir Lach

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