This is the mail archive of the
mailing list for the GCC project.
Re: missed uninitialised variable warning
- From: Michael Matz <matz at suse dot de>
- To: Alexandre Oliva <aoliva at redhat dot com>
- Cc: Andrew Morton <akpm at osdl dot org>, <gcc at gcc dot gnu dot org>
- Date: Mon, 4 Aug 2003 15:06:46 +0200 (CEST)
- Subject: Re: missed uninitialised variable warning
On 4 Aug 2003, Alexandre Oliva wrote:
> > That's a feature.
> Not really. At some point I thought it was, and even argued for it,
I darkly remember.
> but then I was convinced with hard data that it was just a bug that
> I'd happened to take for a feature,
I don't remember this, though.
> and that it was actually undesirable, but hard to fix.
Hmm, hard to fix ... I don't know, the patch below does it for the easy
'x = x' case. But I immediately withdraw it, as I like this feature ;-)
RCS file: /cvs/gcc/gcc/gcc/function.c,v
retrieving revision 1.449
diff -u -p -r1.449 function.c
--- function.c 25 Jul 2003 09:52:25 -0000 1.449
+++ function.c 4 Aug 2003 13:05:23 -0000
@@ -5566,7 +5566,7 @@ uninitialized_vars_warning (tree block)
We do not care about the actual value in DECL_INITIAL, so we do
not worry that it may be a dangling pointer. */
- && DECL_INITIAL (decl) == NULL_TREE
+ && (DECL_INITIAL (decl) == NULL_TREE || DECL_INITIAL (decl) == decl)
&& regno_uninitialized (REGNO (DECL_RTL (decl))))
warning ("%H'%D' might be used uninitialized in this function",
&DECL_SOURCE_LOCATION (decl), decl);