Patch for warnings in dependence.c (some remain)

Kaveh R. Ghazi ghazi@caip.rutgers.edu
Wed Aug 23 10:05:00 GMT 2000


Hi Stan,

I'm getting a bunch of stage3 warnings from dependence.c.  I fixed the
following ones:

 > dependence.c:536: warning: non-static declaration for `get_low_bound' follows static
 > dependence.c: At top level:
 > dependence.c:934: warning: non-static declaration for `normalize_coefficients' follows static
 > dependence.c: In function `ziv_test':
 > dependence.c:1048: warning: unused parameter `distance'
 > dependence.c: In function `gcd_test':
 > dependence.c:1149: warning: unused parameter `distance'
 > dependence.c: In function `merge_dependencies':
 > dependence.c:1232: warning: traditional C rejects automatic aggregate initialization
 > dependence.c: At top level:
 > dependence.c:1341: warning: `dump_node_dependence' defined but not used

I also fixed what looked like real bugs, (check that my choice of fix
for these was okay):

 > dependence.c: In function `get_one_coefficient':
 > dependence.c:910: warning: `value0_is_idx' might be used uninitialized in this function
 > dependence.c:910: warning: `value1_is_idx' might be used uninitialized in this function
 > dependence.c: In function `have_dependence_p':
 > dependence.c:1422: warning: `dest' might be used uninitialized in this function



The following warnings remain.  They are all legitimate warnings IMO,
in that the variables are used uninitialized.  If you let me know what
you meant for these, I can take care of them too.

 > dependence.c: In function `have_dependence_p':
 > dependence.c:1421: warning: `dest_idx' might be used uninitialized in this function
 > dependence.c:1421: warning: `src_idx' might be used uninitialized in this function
 > dependence.c: In function `ziv_test':
 > dependence.c:1052: warning: `idx' might be used uninitialized in this function


(Jeff asked you to be the "maintainer" of this code right?)
Okay to install?

		--Kaveh


2000-08-23  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* dependence.c (dependence_string, direction_string,
	dump_one_node, dump_node_dependence): Hide unused identifiers.
	(get_low_bound, normalize_coefficients): Match definition to
	static prototype.
	(get_low_bound): Initialize variables `value0_is_idx' and
	`value1_is_idx'.
	(ziv_test, gcd_test): Mark parameters with ATTRIBUTE_UNUSED.
	(direction_merge): Avoid automatic aggregate initialization.
	(have_dependence_p): Use `src' not `dest' to set `src_idx'.
	
--- orig/egcs-CVS20000822/gcc/dependence.c	Tue Aug 22 12:16:20 2000
+++ egcs-CVS20000822/gcc/dependence.c	Wed Aug 23 12:41:44 2000
@@ -61,12 +61,14 @@ Boston, MA 02111-1307, USA.  */
 */
 
 enum dependence_type {flow, anti, output, none};
+#if 0
 static const char * dependence_string [] = {"flow", "anti", "output", "none"};
-
+#endif
 enum direction_type {lt, le, eq, gt, ge, star, independent, undef};
+#if 0
 static const char * direction_string [] = {"<", "<=", "=", ">", ">=", "*",
 					   "INDEPENDENT", "UNDEFINED"};
-
+#endif
 enum def_use_type {def, use, init_def_use};
 
 enum du_status_type {seen, unseen};
@@ -206,8 +208,10 @@ static void gcd_test PARAMS ((subscript[
 static int find_gcd PARAMS ((int, int));
 static void merge_dependencies PARAMS ((enum direction_type[][], int[][], int, int));
 static void dump_array_ref PARAMS ((tree));
+#if 0
 static void dump_one_node PARAMS ((def_use*, varray_type*));
 static void dump_node_dependence PARAMS ((void));
+#endif
 int search_dependence PARAMS ((tree));
 void remember_dest_for_dependence PARAMS ((tree));
 int have_dependence_p PARAMS ((rtx, rtx, enum direction_type[], int[]));
@@ -531,7 +535,7 @@ find_induction_variable (init_node, cond
 
 /* Return the low bound for induction VARIABLE in NODE */
 
-int
+static int
 get_low_bound (node, variable)
      tree node;
      char *variable;
@@ -907,7 +911,7 @@ get_one_coefficient (node, coefficients,
     }
   else if (tree_op == MULT_EXPR)
     {
-      int value0, value1, value0_is_idx, value1_is_idx;
+      int value0, value1, value0_is_idx = 0, value1_is_idx = 0;
 
       value0 = get_one_coefficient (TREE_OPERAND (node, 0), coefficients, du,
 				    &tree_op_code);
@@ -929,7 +933,7 @@ get_one_coefficient (node, coefficients,
 
 /* Adjust the COEFFICIENTS as if loop LOOP_PTR were normalized to start at 0. */
 
-void
+static void
 normalize_coefficients (coefficients, loop_ptr, count)
      subscript coefficients [MAX_SUBSCRIPTS];
      loop *loop_ptr;
@@ -1045,7 +1049,7 @@ ziv_test (icoefficients, ocoefficients, 
      subscript icoefficients [MAX_SUBSCRIPTS];
      subscript ocoefficients [MAX_SUBSCRIPTS];
      enum direction_type direction[MAX_SUBSCRIPTS][MAX_SUBSCRIPTS];
-     int distance[MAX_SUBSCRIPTS][MAX_SUBSCRIPTS];
+     int distance[MAX_SUBSCRIPTS][MAX_SUBSCRIPTS] ATTRIBUTE_UNUSED;
      loop *loop_ptr;
      int sub;
 {
@@ -1146,7 +1150,7 @@ gcd_test (icoefficients, ocoefficients, 
      subscript icoefficients [MAX_SUBSCRIPTS];
      subscript ocoefficients [MAX_SUBSCRIPTS];
      enum direction_type direction[MAX_SUBSCRIPTS][MAX_SUBSCRIPTS];
-     int distance[MAX_SUBSCRIPTS][MAX_SUBSCRIPTS];
+     int distance[MAX_SUBSCRIPTS][MAX_SUBSCRIPTS] ATTRIBUTE_UNUSED;
      loop *loop_ptr;
      int sub;
 {
@@ -1220,7 +1224,7 @@ merge_dependencies (direction, distance,
   int i, j;
   int sign;
 
-  enum direction_type direction_merge [8][8] = 
+  static const enum direction_type direction_merge [8][8] = 
   {{lt, le, le, star, star, lt, independent, lt},
    {le, le, le, star, star, le, independent, le},
    {le, le, eq, ge, ge, eq, independent, eq},
@@ -1290,6 +1294,7 @@ dump_array_ref (node)
 
 /* Dump def/use DU. */
 
+#if 0
 static void
 dump_one_node (du, seen)
      def_use *du;
@@ -1357,6 +1362,7 @@ dump_node_dependence (void)
     }
   VARRAY_FREE (seen);
 }
+#endif
 
 /* Return the index into 'dep_chain' if there is a dependency for destination
    dest_to_remember (set by remember_dest_for_dependence) and source node.
@@ -1430,7 +1436,7 @@ have_dependence_p (dest_rtx, src_rtx, di
   if (GET_CODE (SET_SRC (PATTERN (src_rtx))) == MEM)
     {
       src = SET_SRC (PATTERN (src_rtx));
-      src_idx = MEM_DEPENDENCY (dest) - 1;
+      src_idx = MEM_DEPENDENCY (src) - 1;
     }
   if (dest_idx >= 0 || src_idx >= 0)
     return 0;


More information about the Gcc-patches mailing list