public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Sławomir Lach" <slawek@lach.art.pl>
To: gcc@gcc.gnu.org
Subject: Save/Store information, which variable are not initialized
Date: Fri, 04 Mar 2022 17:06:56 +0100	[thread overview]
Message-ID: <6982211.xGEPP2f2DN@localhost.localdomain> (raw)

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.



                 reply	other threads:[~2022-03-04 16:07 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=6982211.xGEPP2f2DN@localhost.localdomain \
    --to=slawek@lach.art.pl \
    --cc=gcc@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).