This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Storage for uninitialized objects (PR 24626)
- From: Ian Lance Taylor <ian at airs dot com>
- To: "John David Anglin" <dave at hiauly1 dot hia dot nrc dot ca>
- Cc: schlie at comcast dot net, gcc at gcc dot gnu dot org
- Date: 21 Jan 2006 11:22:18 -0800
- Subject: Re: Storage for uninitialized objects (PR 24626)
- References: <200601211814.k0LIEQBH006004@hiauly1.hia.nrc.ca>
"John David Anglin" <dave@hiauly1.hia.nrc.ca> writes:
> > No, the ISO C standard is clear that the value of an uninitialized
> > variable is indeterminate. It may be a trap representation, or it may
> > be an unspecified value. In the latter case it must have the correct
> > type. But there is no other restriction on it, and the standard
> > specifically says (3.17.3) it "imposes no requirements on which value
> > is chosen in any instance."
>
> Ok, then I believe that the register selection by reload might be
> improved.
I think the place to address this, if indeed it should be addressed,
is before reload. If a pseudo-register is used while uninitialized,
you can replace the uses with whatever you like. That can be a
constant 0 where that fits the instruction, or, if it is a direct
assignment from the uninitialized pseudo-register to some other
register or memory, you can just remove the assignment.
But since correct programs rarely use uninitialized variables,
optimizing them is likely to be overkill.
Ian