This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
gcc - setting the uninitialized state (tainting variables)
- From: Campbell Barton <ideasman42 at gmail dot com>
- To: gcc at gcc dot gnu dot org
- Date: Sun, 26 May 2013 18:39:54 +1000
- Subject: gcc - setting the uninitialized state (tainting variables)
Hi, I was looking into the possibility of setting a variable as
uninitialized again (after its been initialized at least once
already).
This could be handy for track simple errors when a variables been used
after its value is logically invalid (where its initialized but the
developer decides the value should not be used until re-initialized).
It could be used tag freed memory though I'm aware this isn't
comparable with real static analysis so I wouldn't propose this as a
primary reason to have such a function.
This may be considered an abuse of the uninitialized warning, so some
ability to `taint` a variable could be handy instead.
I attempted to taint a variable by setting it to an uninitialized
value but this only warns on the assignment (rather then transferring
the uninitialized state).
Is this possible or has it been considered before?
I asked this question on stackoverflow, perhaps useful to help give
some more context.
http://stackoverflow.com/questions/16745981/is-there-a-way-to-set-a-variable-as-uninitialized-in-gcc-clang-c
--
- Campbell