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]

[tree-ssa] latent uninitialized variables


All these are exposed by moving uninitialized variable warnings to 
the tree level, and applying them to variables transformed by SRA.


r~


        * cppexp.c (append_digit): Rearrange unsignedp/overflow setting.
        (eval_token, num_binary_op, num_part_mul, num_div_op): Likewise.
        * ra-rewrite.c (rewrite_program2): Zero info.
        * reload.c (decompose): Zero val.
        * tree-ssa-ccp.c (visit_phi_node): Zero phi_val.const_val.

Index: cppexp.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cppexp.c,v
retrieving revision 1.123.2.14
diff -c -p -d -u -r1.123.2.14 cppexp.c
--- cppexp.c	13 Nov 2003 02:37:48 -0000	1.123.2.14
+++ cppexp.c	9 Feb 2004 01:14:31 -0000
@@ -408,6 +408,7 @@ append_digit (cpp_num num, int digit, in
   result.high = num.high << shift;
   result.low = num.low << shift;
   result.high |= num.low >> (PART_PRECISION - shift);
+  result.unsignedp = num.unsignedp;
 
   if (base == 10)
     {
@@ -428,6 +429,7 @@ append_digit (cpp_num num, int digit, in
 
   result.low += add_low;
   result.high += add_high;
+  result.overflow = overflow;
 
   /* The above code catches overflow of a cpp_num type.  This catches
      overflow of the (possibly shorter) target precision.  */
@@ -435,10 +437,8 @@ append_digit (cpp_num num, int digit, in
   num.high = result.high;
   result = num_trim (result, precision);
   if (!num_eq (result, num))
-    overflow = true;
+    result.overflow = true;
 
-  result.unsignedp = num.unsignedp;
-  result.overflow = overflow;
   return result;
 }
 
@@ -520,6 +520,9 @@ eval_token (cpp_reader *pfile, const cpp
   unsigned int temp;
   int unsignedp = 0;
 
+  result.unsignedp = false;
+  result.overflow = false;
+
   switch (token->type)
     {
     case CPP_NUMBER:
@@ -591,7 +594,6 @@ eval_token (cpp_reader *pfile, const cpp
     }
 
   result.unsignedp = !!unsignedp;
-  result.overflow = false;
   return result;
 }
 
@@ -1332,12 +1334,11 @@ num_binary_op (cpp_reader *pfile, cpp_nu
       result.high = lhs.high + rhs.high;
       if (result.low < lhs.low)
 	result.high++;
+      result.unsignedp = lhs.unsignedp || rhs.unsignedp;
+      result.overflow = false;
 
       result = num_trim (result, precision);
-      result.unsignedp = lhs.unsignedp || rhs.unsignedp;
-      if (result.unsignedp)
-	result.overflow = false;
-      else
+      if (!result.unsignedp)
 	{
 	  bool lhsp = num_positive (lhs, precision);
 	  result.overflow = (lhsp == num_positive (rhs, precision)
@@ -1383,7 +1384,8 @@ num_part_mul (cpp_num_part lhs, cpp_num_
 
   result.high += HIGH_PART (middle[0]);
   result.high += HIGH_PART (middle[1]);
-  result.unsignedp = 1;
+  result.unsignedp = true;
+  result.overflow = false;
 
   return result;
 }
@@ -1515,9 +1517,8 @@ num_div_op (cpp_reader *pfile, cpp_num l
   if (op == CPP_DIV)
     {
       result.unsignedp = unsignedp;
-      if (unsignedp)
-	result.overflow = false;
-      else
+      result.overflow = false;
+      if (!unsignedp)
 	{
 	  if (negate)
 	    result = num_negate (result, precision);
Index: ra-rewrite.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ra-rewrite.c,v
retrieving revision 1.4.2.14
diff -c -p -d -u -r1.4.2.14 ra-rewrite.c
--- ra-rewrite.c	3 Jan 2004 23:01:57 -0000	1.4.2.14
+++ ra-rewrite.c	9 Feb 2004 01:14:31 -0000
@@ -1130,6 +1130,8 @@ rewrite_program2 (bitmap new_deaths)
 	  struct ra_insn_info info;
 	  unsigned int n;
 
+	  memset (&info, 0, sizeof info);
+
 	  if (INSN_P (insn) && BLOCK_FOR_INSN (insn) != last_bb)
 	    {
 	      int index = BLOCK_FOR_INSN (insn)->index + 2;
Index: reload.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/reload.c,v
retrieving revision 1.185.2.23
diff -c -p -d -u -r1.185.2.23 reload.c
--- reload.c	30 Jan 2004 13:14:11 -0000	1.185.2.23
+++ reload.c	9 Feb 2004 01:14:32 -0000
@@ -2255,9 +2255,8 @@ decompose (rtx x)
   struct decomposition val;
   int all_const = 0;
 
-  val.reg_flag = 0;
-  val.safe = 0;
-  val.base = 0;
+  memset (&val, 0, sizeof (val));
+
   if (GET_CODE (x) == MEM)
     {
       rtx base = NULL_RTX, offset = 0;
Index: tree-ssa-ccp.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-ssa-ccp.c,v
retrieving revision 1.1.2.136
diff -c -p -d -u -r1.1.2.136 tree-ssa-ccp.c
--- tree-ssa-ccp.c	5 Feb 2004 06:36:51 -0000	1.1.2.136
+++ tree-ssa-ccp.c	9 Feb 2004 01:14:32 -0000
@@ -450,7 +450,10 @@ visit_phi_node (tree phi)
   /* If the variable is volatile or the variable is never referenced in a
      real operand, then consider the PHI node VARYING.  */
   if (short_circuit || TREE_THIS_VOLATILE (SSA_NAME_VAR (PHI_RESULT (phi))))
-    phi_val.lattice_val = VARYING;
+    {
+      phi_val.lattice_val = VARYING;
+      phi_val.const_val = NULL;
+    }
   else
     for (i = 0; i < PHI_NUM_ARGS (phi); i++)
       {


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