missed uninitialised variable warning

Andrew Morton akpm@osdl.org
Mon Aug 4 12:35:00 GMT 2003


Michael Matz <matz@suse.de> wrote:
>
> Hi,
> 
> On Sun, 3 Aug 2003, Andrew Morton wrote:
> 
> > int foo(void)
> > {
> > 	int i = i;
> > 	return i;
> > }
> 
> That's a feature.  GCC doesn't warn about such self-initialization.  It's
> used to silence GCC warnings in code where the user knows, that the
> variable isn't used uninitialized,

What a perfectly terrible idea that was.

> without generating any code, which
>   int i = 0;
> would do.  There was a proposal to implement that feature with some
> attribute and get rid of the above special meaning for that syntax (which
> I quite like btw ;-))  I don't know if the status of that.

It would be nice.  I'm aware of two bugs across the development of the 2.5
kernel which would not have occurred but for this gcc problem.




More information about the Gcc mailing list