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]
Other format: [Raw text]

Patch installed for uninitialized variable warnings


I installed the following patch to cure some "might be used
uninitialized" warnings.  All of these were obvious, the warnings
fixed are listed below.

< config/clipper/clipper.c:226: warning: `bottom' might be used uninitialized in this function
< config/i960/i960.c:2108: warning: `other' might be used uninitialized in this function
< config/i960/i960.c:333: warning: `end' might be used uninitialized in this function
< config/m88k/m88k.c:2020: warning: `temp_reg' might be used uninitialized in this function
< config/mcore/mcore.c:2697: warning: `src' might be used uninitialized in this function
< config/stormy16/stormy16.c:135: warning: `lab' might be used uninitialized in this function
< config/stormy16/stormy16.c:151: warning: `lab' might be used uninitialized in this function
< insn-emit.c:3102: warning: `label4' might be used uninitialized in this function
< insn-emit.c:3618: warning: `base' might be used uninitialized in this function

Tested via cross compiles of cc1 from sparc-sun-solaris2.7 to:

clipper-intergraph-clix
i960-unknown-rtems
m88k-unknown-sysv4
mcore-unknown-elf
xstormy16-unknown-elf

		--Kaveh


2001-11-20  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* clipper.c (clipper_movstr): Avoid uninitialized warning.
	* i960.c (is_mask, legitimize_address): Likewise.
	* m88k.c (m88k_expand_prologue): Likewise.
	* m88k.md: Likewise.
	* mcore.c (emit_new_cond_insn): Likewise.
	* stormy16.c (xstormy16_emit_cbranch): Likewise.

diff -rup orig/egcs-CVS20011118/gcc/config/clipper/clipper.c egcs-CVS20011118/gcc/config/clipper/clipper.c
--- orig/egcs-CVS20011118/gcc/config/clipper/clipper.c	Fri Nov 16 07:30:20 2001
+++ egcs-CVS20011118/gcc/config/clipper/clipper.c	Mon Nov 19 15:03:32 2001
@@ -223,7 +223,7 @@ void
 clipper_movstr (operands)
      rtx *operands;
 {
-  rtx dst,src,cnt,tmp,top,bottom,xops[3];
+  rtx dst,src,cnt,tmp,top,bottom=NULL_RTX,xops[3];
   int align;
   int fixed;
 
diff -rup orig/egcs-CVS20011118/gcc/config/i960/i960.c egcs-CVS20011118/gcc/config/i960/i960.c
--- orig/egcs-CVS20011118/gcc/config/i960/i960.c	Wed Oct 31 16:30:55 2001
+++ egcs-CVS20011118/gcc/config/i960/i960.c	Mon Nov 19 15:10:48 2001
@@ -330,7 +330,7 @@ int
 is_mask (val)
      unsigned int val;
 {
-  register int start, end, i;
+  register int start, end = 0, i;
 
   start = -1;
   for (i = 0; val != 0; val >>= 1, i++)
@@ -2118,7 +2118,7 @@ legitimize_address (x, oldx, mode)
 	  other = XEXP (x, 1);
 	}
       else
-	constant = 0;
+	constant = 0, other = 0;
 
       if (constant)
 	x = gen_rtx_PLUS (Pmode,
diff -rup orig/egcs-CVS20011118/gcc/config/m88k/m88k.c egcs-CVS20011118/gcc/config/m88k/m88k.c
--- orig/egcs-CVS20011118/gcc/config/m88k/m88k.c	Thu Nov 15 16:30:39 2001
+++ egcs-CVS20011118/gcc/config/m88k/m88k.c	Mon Nov 19 15:12:02 2001
@@ -2017,7 +2017,7 @@ m88k_expand_prologue ()
     {
       rtx return_reg = gen_rtx_REG (SImode, 1);
       rtx label = gen_label_rtx ();
-      rtx temp_reg;
+      rtx temp_reg = NULL_RTX;
 
       if (! save_regs[1])
 	{
diff -rup orig/egcs-CVS20011118/gcc/config/m88k/m88k.md egcs-CVS20011118/gcc/config/m88k/m88k.md
--- orig/egcs-CVS20011118/gcc/config/m88k/m88k.md	Tue Jul  3 16:30:32 2001
+++ egcs-CVS20011118/gcc/config/m88k/m88k.md	Mon Nov 19 16:06:40 2001
@@ -2931,7 +2931,7 @@
       rtx label1 = gen_label_rtx ();
       rtx label2 = gen_label_rtx ();
       rtx label3 = gen_label_rtx ();
-      rtx label4;
+      rtx label4 = NULL_RTX;
 
       emit_insn (gen_negsi2 (neg_op2, op2));
       emit_insn (gen_cmpsi (op2, const0_rtx));
@@ -3799,7 +3799,7 @@
   register rtx index_diff = gen_reg_rtx (SImode);
   register rtx low = GEN_INT (-INTVAL (operands[1]));
   register rtx label = gen_rtx_LABEL_REF (Pmode, operands[3]);
-  register rtx base;
+  register rtx base = NULL_RTX;
 
   if (! CASE_VECTOR_INSNS)
     /* These instructions are likely to be scheduled and made loop invariant.
diff -rup orig/egcs-CVS20011118/gcc/config/mcore/mcore.c egcs-CVS20011118/gcc/config/mcore/mcore.c
--- orig/egcs-CVS20011118/gcc/config/mcore/mcore.c	Sun Nov 18 21:51:32 2001
+++ egcs-CVS20011118/gcc/config/mcore/mcore.c	Mon Nov 19 15:14:07 2001
@@ -2708,7 +2708,10 @@ emit_new_cond_insn (insn, cond)
       src = SET_SRC (pat);
     }
   else
-    dst = JUMP_LABEL (insn);
+    {
+      dst = JUMP_LABEL (insn);
+      src = NULL_RTX;
+    }
 
   switch (num)
     {
diff -rup orig/egcs-CVS20011118/gcc/config/stormy16/stormy16.c egcs-CVS20011118/gcc/config/stormy16/stormy16.c
--- orig/egcs-CVS20011118/gcc/config/stormy16/stormy16.c	Sat Nov 10 20:45:45 2001
+++ egcs-CVS20011118/gcc/config/stormy16/stormy16.c	Mon Nov 19 15:21:37 2001
@@ -132,7 +132,7 @@ xstormy16_emit_cbranch (code, loc)
     {
       int unsigned_p = (code == GTU || code == LEU);
       int gt_p = (code == GT || code == GTU);
-      rtx lab;
+      rtx lab = NULL_RTX;
       
       if (gt_p)
 	lab = gen_label_rtx ();
@@ -148,7 +148,7 @@ xstormy16_emit_cbranch (code, loc)
 	   && (code == NE || code == EQ)
 	   && op1 != const0_rtx)
     {
-      rtx lab;
+      rtx lab = NULL_RTX;
       int num_words = GET_MODE_BITSIZE (mode) / BITS_PER_WORD;
       int i;
       


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