This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Add uninitialized attribute?
- From: Michael Matz <matz at suse dot de>
- To: "H.J. Lu" <hjl dot tools at gmail dot com>
- Cc: GCC Development <gcc at gcc dot gnu dot org>, "Kreitzer, David L" <david dot l dot kreitzer at intel dot com>, "Girkar, Milind" <milind dot girkar at intel dot com>
- Date: Mon, 30 Aug 2010 14:46:57 +0200 (CEST)
- Subject: Re: Add uninitialized attribute?
- References: <AANLkTikiQ3dRQuNjCNHKQk+QQ4pPYj14V-A5Brb0fan7@mail.gmail.com>
Hi,
On Fri, 20 Aug 2010, H.J. Lu wrote:
> int x = 0;
>
> to silence gcc from uninitialized warnings when I know it is
> unnecessary. Is that a good idea to add
>
> int x __attribute__ ((uninitialized));
>
> to tell compiler that it is OK for "x" to be uninitialized?
int x = x;
is the way GCC offers this idiom since about forever, no need for an
attribute. Downthread I see that people worry about this generating an
actual (uninitialized) access to x. They are confused.
Ciao,
Michael.