This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Patch: used uninitialized warnings cp/{call,init}.c


Remove `might be used uninitialized in this function' warnings,
no regressions on i586-sco-sysv5uw7.1.0.

 stage2/xgcc -Bstage2/ -B/usr/local/i586-sco-sysv5uw7.1.0/bin/ -c  -DIN_GCC    -g -O2 -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes   -DHAVE_CONFIG_H    -I. -Icp -I../../gcc-20010312/gcc -I../../gcc-20010312/gcc/cp -I../../gcc-20010312/gcc/config -I../../gcc-20010312/gcc/../include ../../gcc-20010312/gcc/cp/call.c -o cp/call.o
-../../gcc-20010312/gcc/cp/call.c: In function `convert_like_real':
-../../gcc-20010312/gcc/cp/call.c:3681: warning: `savew' might be used uninitialized in this function
-../../gcc-20010312/gcc/cp/call.c:3681: warning: `savee' might be used uninitialized in this function
-../../gcc-20010312/gcc/cp/call.c: In function `joust':
-../../gcc-20010312/gcc/cp/call.c:5308: warning: `w' might be used uninitialized in this function
-../../gcc-20010312/gcc/cp/call.c:5308: warning: `l' might be used uninitialized in this function

 stage2/xgcc -Bstage2/ -B/usr/local/i586-sco-sysv5uw7.1.0/bin/ -c  -DIN_GCC    -g -O2 -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes   -DHAVE_CONFIG_H    -I. -Icp -I../../gcc-20010312/gcc -I../../gcc-20010312/gcc/cp -I../../gcc-20010312/gcc/config -I../../gcc-20010312/gcc/../include ../../gcc-20010312/gcc/cp/init.c -o cp/init.o
-../../gcc-20010312/gcc/cp/init.c: In function `build_java_class_ref':
-../../gcc-20010312/gcc/cp/init.c:2203: warning: `name' might be used uninitialized in this function

2001-03-19  Rodney Brown  <RodneyBrown@mynd.com>

	Remove `might be used uninitialized' warnings.
	* call.c (convert_like_real): Unconditionally initialize `savew' and
	`savee' in `BASE_CONV' case.
	(joust): Initialize `w' and `l'.
	* init.c (build_java_class_ref): Initialize `name', minor reformatting.

--- cp/call.c.orig	Fri Mar 16 10:51:05 2001
+++ cp/call.c	Mon Mar 19 10:28:28 2001
@@ -3832,8 +3832,7 @@ convert_like_real (convs, expr, fn, argn
       /* Copy-initialization where the cv-unqualified version of the source
 	 type is the same class as, or a derived class of, the class of the
 	 destination [is treated as direct-initialization].  [dcl.init] */
-      if (fn)
-	savew = warningcount, savee = errorcount;
+      savew = warningcount, savee = errorcount;
       expr = build_new_method_call (NULL_TREE, complete_ctor_identifier,
 				    build_tree_list (NULL_TREE, expr),
 				    TYPE_BINFO (totype),
@@ -5305,7 +5304,7 @@ tweak:
   if (!pedantic)
     {
       int rank1 = IDENTITY_RANK, rank2 = IDENTITY_RANK;
-      struct z_candidate *w, *l;
+      struct z_candidate *w = NULL, *l = NULL;
 
       for (i = 0; i < len; ++i)
 	{
--- cp/init.c.orig	Wed Mar  7 10:34:10 2001
+++ cp/init.c	Mon Mar 19 10:11:59 2001
@@ -2200,8 +2200,9 @@ tree
 build_java_class_ref (type)
      tree type;
 {
-  tree name, class_decl;
+  tree name = NULL_TREE, class_decl;
   static tree CL_suffix = NULL_TREE;
+
   if (CL_suffix == NULL_TREE)
     CL_suffix = get_identifier("class$");
   if (jclass_node == NULL_TREE)
@@ -2224,7 +2225,7 @@ build_java_class_ref (type)
 	}
     if (!field)
       internal_error ("Can't find class$");
-    }
+  }
 
   class_decl = IDENTIFIER_GLOBAL_VALUE (name);
   if (class_decl == NULL_TREE)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]