This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Missing warning?
- From: Matthew Wilcox <willy at debian dot org>
- To: gcc at gcc dot gnu dot org
- Date: Fri, 4 Oct 2002 14:42:00 +0100
- Subject: Missing warning?
I think the following program should produce some kind of warning
(probably "warning: `x' might be used uninitialized in this function")
extern void bar(void *);
int main(void)
{
void *x = x;
bar(x);
return 0;
}
If the initialisation of x is separated out as:
int main(void)
{
void *x;
x = x;
bar(x);
return 0;
}
then GCC does warn about use of an uninitialised variable. This behaviour
is constant across gcc 2.95, 3.0 and 3.2. I guess it's possible that this
behaviour is required by the C spec, but it seems a little unreasonable
to me.
--
Revolutions do not require corporate support.