Patch for "uninitialized" warnings

Kaveh R. Ghazi ghazi@caip.rutgers.edu
Thu Dec 30 21:17:00 GMT 1999


This zaps a bunch of "uninitialized" warnings.

Okay to install?

		--Kaveh



1999-12-30  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* builtins.c (expand_builtin_strlen): Initialize variable `icode'.

	* calls.c (expand_call): Likewise for
	`old_stack_arg_under_construction'.

	* cpphash.c (macroexpand): Likewise for `args' and `rest_zero'.

	* function.c (pad_to_arg_alignment): Likewise for `save_var' and
	`save_constant'.

	* gcc.c (execute): Likewise for `ut' and `st'.

	* genattrtab.c (attr_rtx): Likewise for `rt_val'.

	* genopinit.c (gen_insn): Likewise for `m1', `m2' and `op'.

	* jump.c (jump_optimize_1): Likewise for `temp2'.

	* local-alloc.c (block_alloc): Likewise for `r1'.

	* loop.c (recombine_givs): Likewise for `life_start' and `life_end'.

	* reg-stack.c (check_asm_stack_operands): Likewise for `clobber_reg'.
	(subst_asm_stack_regs): Likewise for `clobber_reg' and `clobber_loc'.
	
	* regmove.c (fixup_match_1): Likewise for `insn_const', `dst_node'
	and `set2'.

	* reload.c (find_reloads): Likewise for `goal_alternative_number'
	and `goal_earlyclobber'.

	* scan-decls.c (scan_decls): Likewise for `prev_id_end'.

	* sdbout.c (sdbout_one_type): Likewise for `member_scl'.

	* stupid.c (stupid_life_analysis): Likewise for `chain'.

	* unroll.c (copy_loop_body): Likewise for `copy'.

	* varasm.c (output_constructor): Likewise for `byte'.	
	
ch:
	* actions.c (update_else_range_for_int_const): Initialize
	variables `lowval' and `highval'.
	(update_else_range_for_range): Likewise for `low_range_val' and
	`high_range_val'.

cp:
	* class.c (warn_hidden): Initialize variable `fndecl'.


diff -rup orig/egcs-CVS19991230/gcc/builtins.c egcs-CVS19991230/gcc/builtins.c
--- orig/egcs-CVS19991230/gcc/builtins.c	Wed Dec 15 22:53:59 1999
+++ egcs-CVS19991230/gcc/builtins.c	Thu Dec 30 12:01:09 1999
@@ -1303,7 +1303,7 @@ expand_builtin_strlen (exp, target, mode
 
       rtx result, src_rtx, char_rtx;
       enum machine_mode insn_mode = value_mode, char_mode;
-      enum insn_code icode;
+      enum insn_code icode = CODE_FOR_nothing;
 
       /* If the length is known, just return it.  */
       if (len != 0)
diff -rup orig/egcs-CVS19991230/gcc/calls.c egcs-CVS19991230/gcc/calls.c
--- orig/egcs-CVS19991230/gcc/calls.c	Thu Dec  9 15:35:39 1999
+++ egcs-CVS19991230/gcc/calls.c	Thu Dec 30 11:39:22 1999
@@ -1660,7 +1660,7 @@ expand_call (exp, target, ignore)
 #ifdef ACCUMULATE_OUTGOING_ARGS
   int initial_highest_arg_in_use = highest_outgoing_arg_in_use;
   char *initial_stack_usage_map = stack_usage_map;
-  int old_stack_arg_under_construction;
+  int old_stack_arg_under_construction = 0;
 #endif
 
   rtx old_stack_level = 0;
diff -rup orig/egcs-CVS19991230/gcc/ch/actions.c egcs-CVS19991230/gcc/ch/actions.c
--- orig/egcs-CVS19991230/gcc/ch/actions.c	Wed Sep 15 10:18:33 1999
+++ egcs-CVS19991230/gcc/ch/actions.c	Thu Dec 30 12:07:25 1999
@@ -788,7 +788,7 @@ static tree
 update_else_range_for_int_const (else_range, label)
      tree else_range, label;
 {
-  int  lowval, highval;
+  int  lowval = 0, highval = 0;
   int  label_value = TREE_INT_CST_LOW (label);
   tree this_range, prev_range, new_range;
 
@@ -846,7 +846,7 @@ update_else_range_for_range (else_range,
      tree else_range, low_target, high_target;
 {
   tree this_range, prev_range, new_range, next_range;
-  int  low_range_val, high_range_val;
+  int  low_range_val = 0, high_range_val = 0;
   int  low_target_val  = TREE_INT_CST_LOW (low_target);
   int  high_target_val = TREE_INT_CST_LOW (high_target);
 
diff -rup orig/egcs-CVS19991230/gcc/cp/class.c egcs-CVS19991230/gcc/cp/class.c
--- orig/egcs-CVS19991230/gcc/cp/class.c	Wed Dec 29 15:46:27 1999
+++ egcs-CVS19991230/gcc/cp/class.c	Thu Dec 30 12:07:46 1999
@@ -3007,7 +3007,7 @@ warn_hidden (t)
   for (i = 2; i < n_methods && TREE_VEC_ELT (method_vec, i); ++i)
     {
       tree fns = TREE_VEC_ELT (method_vec, i);
-      tree fndecl;
+      tree fndecl = NULL_TREE;
 
       tree base_fndecls = NULL_TREE;
       tree binfos = BINFO_BASETYPES (TYPE_BINFO (t));
diff -rup orig/egcs-CVS19991230/gcc/cpphash.c egcs-CVS19991230/gcc/cpphash.c
--- orig/egcs-CVS19991230/gcc/cpphash.c	Fri Oct 29 07:37:31 1999
+++ egcs-CVS19991230/gcc/cpphash.c	Thu Dec 30 12:09:09 1999
@@ -1051,12 +1051,12 @@ macroexpand (pfile, hp)
   register U_CHAR *xbuf;
   long start_line, start_column;
   int xbuf_len;
-  struct argdata *args;
+  struct argdata *args = 0;
   long old_written = CPP_WRITTEN (pfile);
 #if 0
   int start_line = instack[indepth].lineno;
 #endif
-  int rest_args, rest_zero;
+  int rest_args, rest_zero = 0;
   register int i;
 
 #if 0
diff -rup orig/egcs-CVS19991230/gcc/function.c egcs-CVS19991230/gcc/function.c
--- orig/egcs-CVS19991230/gcc/function.c	Tue Dec 28 07:46:43 1999
+++ egcs-CVS19991230/gcc/function.c	Thu Dec 30 11:38:18 1999
@@ -5067,8 +5067,8 @@ pad_to_arg_alignment (offset_ptr, bounda
      int boundary;
      struct args_size *alignment_pad;
 {
-  tree save_var;
-  HOST_WIDE_INT save_constant;
+  tree save_var = NULL_TREE;
+  HOST_WIDE_INT save_constant = 0;
 
   int boundary_in_bytes = boundary / BITS_PER_UNIT;
   
diff -rup orig/egcs-CVS19991230/gcc/gcc.c egcs-CVS19991230/gcc/gcc.c
--- orig/egcs-CVS19991230/gcc/gcc.c	Tue Dec 14 10:56:10 1999
+++ egcs-CVS19991230/gcc/gcc.c	Thu Dec 30 12:12:15 1999
@@ -2575,7 +2575,7 @@ execute ()
     int ret_code = 0;
 #ifdef HAVE_GETRUSAGE
     struct timeval d;
-    double ut, st;
+    double ut = 0.0, st = 0.0;
 #endif
 
     for (i = 0; i < n_commands; )
diff -rup orig/egcs-CVS19991230/gcc/genattrtab.c egcs-CVS19991230/gcc/genattrtab.c
--- orig/egcs-CVS19991230/gcc/genattrtab.c	Thu Oct 14 07:42:57 1999
+++ egcs-CVS19991230/gcc/genattrtab.c	Thu Dec 30 12:06:54 1999
@@ -542,8 +542,8 @@ attr_rtx VPROTO((enum rtx_code code, ...
 #endif
   va_list p;
   register int i;		/* Array indices...			*/
-  register const char *fmt;		/* Current rtx's format...		*/
-  register rtx rt_val;		/* RTX to return to caller...		*/
+  register const char *fmt;	/* Current rtx's format...		*/
+  register rtx rt_val = NULL_RTX;/* RTX to return to caller...		*/
   int hashcode;
   register struct attr_hash *h;
   struct obstack *old_obstack = rtl_obstack;
diff -rup orig/egcs-CVS19991230/gcc/genopinit.c egcs-CVS19991230/gcc/genopinit.c
--- orig/egcs-CVS19991230/gcc/genopinit.c	Thu Oct 14 07:42:58 1999
+++ egcs-CVS19991230/gcc/genopinit.c	Thu Dec 30 11:54:42 1999
@@ -128,7 +128,7 @@ gen_insn (insn)
      rtx insn;
 {
   char *name = XSTR (insn, 0);
-  int m1, m2, op;
+  int m1 = 0, m2 = 0, op = 0;
   size_t pindex;
   int i;
   const char *np, *pp, *p, *q;
diff -rup orig/egcs-CVS19991230/gcc/jump.c egcs-CVS19991230/gcc/jump.c
--- orig/egcs-CVS19991230/gcc/jump.c	Wed Dec 29 16:12:48 1999
+++ egcs-CVS19991230/gcc/jump.c	Thu Dec 30 12:02:03 1999
@@ -309,7 +309,7 @@ jump_optimize_1 (f, cross_jump, noop_mov
       for (insn = f; insn; insn = next)
 	{
 	  rtx reallabelprev;
-	  rtx temp, temp1, temp2, temp3, temp4, temp5, temp6;
+	  rtx temp, temp1, temp2 = NULL_RTX, temp3, temp4, temp5, temp6;
 	  rtx nlabel;
 	  int this_is_simplejump, this_is_condjump, reversep = 0;
 	  int this_is_condjump_in_parallel;
diff -rup orig/egcs-CVS19991230/gcc/local-alloc.c egcs-CVS19991230/gcc/local-alloc.c
--- orig/egcs-CVS19991230/gcc/local-alloc.c	Fri Dec 24 09:00:38 1999
+++ egcs-CVS19991230/gcc/local-alloc.c	Thu Dec 30 11:51:58 1999
@@ -1082,7 +1082,7 @@ block_alloc (b)
 	{
 	  register rtx link, set;
 	  register int win = 0;
-	  register rtx r0, r1;
+	  register rtx r0, r1 = NULL_RTX;
 	  int combined_regno = -1;
 	  int i;
 
diff -rup orig/egcs-CVS19991230/gcc/loop.c egcs-CVS19991230/gcc/loop.c
--- orig/egcs-CVS19991230/gcc/loop.c	Tue Dec 28 07:46:48 1999
+++ egcs-CVS19991230/gcc/loop.c	Thu Dec 30 11:43:36 1999
@@ -7682,7 +7682,7 @@ recombine_givs (bl, loop_start, loop_end
      LAST_GIV.  */
   for (i = giv_count - 1; i >= 0; i = rescan)
     {
-      int life_start, life_end;
+      int life_start = 0, life_end = 0;
 
       for (last_giv = 0, rescan = -1; i >= 0; i--)
 	{
diff -rup orig/egcs-CVS19991230/gcc/reg-stack.c egcs-CVS19991230/gcc/reg-stack.c
--- orig/egcs-CVS19991230/gcc/reg-stack.c	Thu Nov 25 10:51:52 1999
+++ egcs-CVS19991230/gcc/reg-stack.c	Thu Dec 30 12:10:54 1999
@@ -589,7 +589,7 @@ check_asm_stack_operands (insn)
   char implicitly_dies[FIRST_PSEUDO_REGISTER];
   int alt;
 
-  rtx *clobber_reg;
+  rtx *clobber_reg = 0;
   int n_inputs, n_outputs;
 
   /* Find out what the constraints require.  If no constraint
@@ -1792,8 +1792,8 @@ subst_asm_stack_regs (insn, regstack)
   rtx **note_loc;		/* Address of REG field of each note */
   enum reg_note *note_kind;	/* The type of each note */
 
-  rtx *clobber_reg;
-  rtx **clobber_loc;
+  rtx *clobber_reg = 0;
+  rtx **clobber_loc = 0;
 
   struct stack_def temp_stack;
   int n_notes;
diff -rup orig/egcs-CVS19991230/gcc/regmove.c egcs-CVS19991230/gcc/regmove.c
--- orig/egcs-CVS19991230/gcc/regmove.c	Thu Dec 16 21:49:06 1999
+++ egcs-CVS19991230/gcc/regmove.c	Thu Dec 30 11:51:30 1999
@@ -1604,9 +1604,9 @@ fixup_match_1 (insn, set, src, src_subre
   int success = 0;
   int num_calls = 0, s_num_calls = 0;
   enum rtx_code code = NOTE;
-  HOST_WIDE_INT insn_const, newconst;
+  HOST_WIDE_INT insn_const = 0, newconst;
   rtx overlap = 0; /* need to move insn ? */
-  rtx src_note = find_reg_note (insn, REG_DEAD, src), dst_note;
+  rtx src_note = find_reg_note (insn, REG_DEAD, src), dst_note = NULL_RTX;
   int length, s_length;
 
   /* If SRC is marked as unchanging, we may not change it.
@@ -1695,7 +1695,7 @@ fixup_match_1 (insn, set, src, src_subre
 	  if (! src_note)
 	    {
 	      rtx q;
-	      rtx set2;
+	      rtx set2 = NULL_RTX;
 
 	      /* If an optimization is done, the value of SRC while P
 		 is executed will be changed.  Check that this is OK.  */
@@ -1872,7 +1872,7 @@ fixup_match_1 (insn, set, src, src_subre
   if (! overlap && (code == PLUS || code == MINUS))
     {
       rtx note = find_reg_note (insn, REG_EQUAL, NULL_RTX);
-      rtx q, set2;
+      rtx q, set2 = NULL_RTX;
       int num_calls2 = 0, s_length2 = 0;
 
       if (note && CONSTANT_P (XEXP (note, 0)))
diff -rup orig/egcs-CVS19991230/gcc/reload.c egcs-CVS19991230/gcc/reload.c
--- orig/egcs-CVS19991230/gcc/reload.c	Fri Dec 24 09:00:42 1999
+++ egcs-CVS19991230/gcc/reload.c	Thu Dec 30 11:52:35 1999
@@ -2383,7 +2383,7 @@ find_reloads (insn, replace, ind_levels,
   int swapped;
   int goal_alternative[MAX_RECOG_OPERANDS];
   int this_alternative_number;
-  int goal_alternative_number;
+  int goal_alternative_number = 0;
   int operand_reloadnum[MAX_RECOG_OPERANDS];
   int goal_alternative_matches[MAX_RECOG_OPERANDS];
   int goal_alternative_matched[MAX_RECOG_OPERANDS];
@@ -2397,7 +2397,7 @@ find_reloads (insn, replace, ind_levels,
   rtx substed_operand[MAX_RECOG_OPERANDS];
   rtx body = PATTERN (insn);
   rtx set = single_set (insn);
-  int goal_earlyclobber, this_earlyclobber;
+  int goal_earlyclobber = 0, this_earlyclobber;
   enum machine_mode operand_mode[MAX_RECOG_OPERANDS];
   int retval = 0;
 
diff -rup orig/egcs-CVS19991230/gcc/scan-decls.c egcs-CVS19991230/gcc/scan-decls.c
--- orig/egcs-CVS19991230/gcc/scan-decls.c	Sun Oct  3 12:47:51 1999
+++ egcs-CVS19991230/gcc/scan-decls.c	Thu Dec 30 11:57:58 1999
@@ -88,7 +88,7 @@ scan_decls (pfile, argc, argv)
      declarator.  If it is zero, we are either still parsing the
      decl-specs, or prev_id_start marks the start of the declarator.  */
   int declarator_start;
-  int prev_id_start, prev_id_end;
+  int prev_id_start, prev_id_end = 0;
   enum cpp_token token;
 
  new_statement:
diff -rup orig/egcs-CVS19991230/gcc/sdbout.c egcs-CVS19991230/gcc/sdbout.c
--- orig/egcs-CVS19991230/gcc/sdbout.c	Sun Apr 18 09:09:29 1999
+++ egcs-CVS19991230/gcc/sdbout.c	Thu Dec 30 11:43:09 1999
@@ -1173,7 +1173,7 @@ sdbout_one_type (type)
       /* Output a structure type.  */
       {
 	int size = int_size_in_bytes (type);
-	int member_scl;
+	int member_scl = 0;
 	tree tem;
 	int i, n_baseclasses = 0;
 
diff -rup orig/egcs-CVS19991230/gcc/stupid.c egcs-CVS19991230/gcc/stupid.c
--- orig/egcs-CVS19991230/gcc/stupid.c	Tue Dec 28 07:46:48 1999
+++ egcs-CVS19991230/gcc/stupid.c	Thu Dec 30 11:49:01 1999
@@ -264,7 +264,7 @@ stupid_life_analysis (f, nregs, file)
   for (insn = last; insn; insn = PREV_INSN (insn))
     {
       register HARD_REG_SET *p = after_insn_hard_regs + INSN_SUID (insn);
-      struct insn_chain *chain;
+      struct insn_chain *chain = 0;
 
       /* Copy the info in regs_live into the element of after_insn_hard_regs
 	 for the current position in the rtl code.  */
diff -rup orig/egcs-CVS19991230/gcc/unroll.c egcs-CVS19991230/gcc/unroll.c
--- orig/egcs-CVS19991230/gcc/unroll.c	Tue Dec 28 07:46:49 1999
+++ egcs-CVS19991230/gcc/unroll.c	Thu Dec 30 11:47:46 1999
@@ -1692,7 +1692,7 @@ copy_loop_body (copy_start, copy_end, ma
      rtx start_label, loop_end, insert_before, copy_notes_from;
 {
   rtx insn, pattern;
-  rtx set, tem, copy;
+  rtx set, tem, copy = NULL_RTX;
   int dest_reg_was_split, i;
 #ifdef HAVE_cc0
   rtx cc0_insn = 0;
diff -rup orig/egcs-CVS19991230/gcc/varasm.c egcs-CVS19991230/gcc/varasm.c
--- orig/egcs-CVS19991230/gcc/varasm.c	Mon Dec 20 15:00:17 1999
+++ egcs-CVS19991230/gcc/varasm.c	Thu Dec 30 11:41:52 1999
@@ -4318,7 +4318,7 @@ output_constructor (exp, size)
   int total_bytes = 0;
   /* Non-zero means BYTE contains part of a byte, to be output.  */
   int byte_buffer_in_use = 0;
-  register int byte;
+  register int byte = 0;
 
   if (HOST_BITS_PER_WIDE_INT < BITS_PER_UNIT)
     abort ();


More information about the Gcc-patches mailing list