This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Storage for uninitialized objects (PR 24626)
On Sun, 14 Jan 2006, Ian Lance Taylor wrote:
> gcc assumes that if a variable is uninitialized, it can use any value
> whatsoever for any use of the variable. gcc does not assume that all
> uses of an uninitialized variable must have the same value.
Indeed, the rulings on DR#260 are perfectly clear.
Question 1:
Values may have any bit-pattern that validly represents them and
the implementation is free to move between alternate
representations (for example, it may normalize pointers,
floating-point representations etc.). In the case of an
indeterminate value all bit-patterns are valid representations and
the actual bit-pattern may change without direct action of the
program.
Question 2:
If two objects have identical bit-pattern representations and their
types are the same they may still compare as unequal (for example
if one object has an indeterminate value) and if one is an
indeterminate value attempting to read such an object invokes
undefined behavior. Implementations are permitted to track the
origins of a bit-pattern and treat those representing an
indeterminate value as distinct from those representing a
determined value. They may also treat pointers based on different
origins as distinct even though they are bitwise identical.
--
Joseph S. Myers http://www.srcf.ucam.org/~jsm28/gcc/
jsm@polyomino.org.uk (personal mail)
joseph@codesourcery.com (CodeSourcery mail)
jsm28@gcc.gnu.org (Bugzilla assignments and CCs)