missed uninitialised variable warning
Michael Matz
matz@suse.de
Mon Aug 4 13:39:00 GMT 2003
Hi,
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 ;-)
Ciao,
Michael.
Index: function.c
===================================================================
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);
More information about the Gcc
mailing list