aboutsummaryrefslogtreecommitdiff
path: root/gcc/function.c
diff options
context:
space:
mode:
authorJeffrey A Law <law@cygnus.com>1998-10-18 16:34:41 +0000
committerJeff Law <law@gcc.gnu.org>1998-10-18 10:34:41 -0600
commit6acdd0fd75cae3f5a1af6c60b59a233102703b8d (patch)
treee414ee2f7817e53cd035404e67a562a70c276dec /gcc/function.c
parent39ee4d93e673f9f1ab52fcc357e8c5bd8a873090 (diff)
function.c (uninitialized_vars_warning): Do not warn for a VAR_DECL if it has a nonzero DECL_INITIAL.
* function.c (uninitialized_vars_warning): Do not warn for a VAR_DECL if it has a nonzero DECL_INITIAL. From-SVN: r23164
Diffstat (limited to 'gcc/function.c')
-rw-r--r--gcc/function.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/function.c b/gcc/function.c
index e594e7000f5..148acc0e4fb 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -4907,6 +4907,14 @@ uninitialized_vars_warning (block)
&& ! AGGREGATE_TYPE_P (TREE_TYPE (decl))
&& DECL_RTL (decl) != 0
&& GET_CODE (DECL_RTL (decl)) == REG
+ /* Global optimizations can make it difficult to determine if a
+ particular variable has been initialized. However, a VAR_DECL
+ with a nonzero DECL_INITIAL had an initializer, so do not
+ claim it is potentially uninitialized.
+
+ 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
&& regno_uninitialized (REGNO (DECL_RTL (decl))))
warning_with_decl (decl,
"`%s' might be used uninitialized in this function");