This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Add uninitialized attribute?
On 08/30/2010 03:50 PM, Vincent Lefevre wrote:
> On 2010-08-30 14:46:57 +0200, Michael Matz wrote:
>> 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.
>
> This is not a good idea as "int x = x;" may really generate an
> (uninitialized) access to x with other compilers.
Absolutely so. I suspect it's even undefined behaviour in the standard
language. There's no way that this idiom should appear anywhere in
GNU code.
Andrew.