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]

Fix problems/warnings in combine.c, libgcc2.c and gcov.c



The appended patch fixes those two warnings:
/cvs/gcc/gcc/combine.c:9720: warning: unused variable `new'
/cvs/gcc/gcc/libgcc2.c:1570: warning: long int format, different type arg (arg 6)
/cvs/gcc/gcc/gcov.c:1365: warning: int format, different type arg (arg 4)
/cvs/gcc/gcc/gcov.c:1370: warning: int format, different type arg (arg 4)
/cvs/gcc/gcc/gcov.c:1383: warning: int format, different type arg (arg 4)
/cvs/gcc/gcc/gcov.c:1389: warning: int format, different type arg (arg 4)

It also fixes a possible overflow in __bb_exit_func (we assigned a
gcov_type which might be long long to a long variable).  But in this
case we should fix num_digits also to have a long long parameter
(alternativly gcov_type).

It passed Bootstrapp on i686-linux,  make check is running.  Ok to
commit if it passes the testsuite?

Andreas

2001-07-14  Andreas Jaeger  <aj@suse.de>

	* gcov.c (output_data): Use HOST_WIDEST_INT_PRINT_DEC to output
	variables of type HOST_WIDEST_INT.

	* libgcc2.c (__bb_exit_func): Handle gcov_type as long long.
	(__bb_exit_func): Correct type of count_max to avoid overflow.
	(num_digits): Handle long long argument.

	* combine.c (gen_lowpart_for_combine): Remove unused variable.

============================================================
Index: gcc/combine.c
--- gcc/combine.c	2001/07/13 15:05:51	1.214
+++ gcc/combine.c	2001/07/14 07:20:30
@@ -9717,7 +9717,6 @@
   if (GET_CODE (x) == MEM)
     {
       register int offset = 0;
-      rtx new;
 
       /* Refuse to work on a volatile memory ref or one with a mode-dependent
 	 address.  */
============================================================
Index: gcc/libgcc2.c
--- gcc/libgcc2.c	2001/06/22 17:18:20	1.121
+++ gcc/libgcc2.c	2001/07/14 07:20:32
@@ -1311,13 +1311,13 @@
 
 static struct bb *bb_head;
 
-static int num_digits (long value, int base) __attribute__ ((const));
+static int num_digits (long long value, int base) __attribute__ ((const));
 
 /* Return the number of digits needed to print a value */
-/* __inline__ */ static int num_digits (long value, int base)
+/* __inline__ */ static int num_digits (long long value, int base)
 {
   int minus = (value < 0 && base != 16);
-  unsigned long v = (minus) ? -value : value;
+  unsigned long long v = (minus) ? -value : value;
   int ret = minus;
 
   do
@@ -1512,7 +1512,7 @@
 	  int file_p	= (func_p && ptr->filenames);
 	  int addr_p	= (ptr->addresses != 0);
 	  long ncounts	= ptr->ncounts;
-	  long cnt_max  = 0;
+	  gcov_type cnt_max  = 0;
 	  long line_max = 0;
 	  long addr_max = 0;
 	  int file_len	= 0;
@@ -1564,11 +1564,17 @@
 	  /* Now print out the basic block information.  */
 	  for (i = 0; i < ncounts; i++)
 	    {
+#if LONG_TYPE_SIZE == GCOV_TYPE_SIZE	      
 	      fprintf (file,
 		       "    Block #%*d: executed %*ld time(s)",
 		       blk_len, i+1,
 		       cnt_len, ptr->counts[i]);
-
+#else
+	      fprintf (file,
+		       "    Block #%*d: executed %*lld time(s)",
+		       blk_len, i+1,
+		       cnt_len, ptr->counts[i]);
+#endif
 	      if (addr_p)
 		fprintf (file, " address= 0x%.*lx", addr_len,
 			 ptr->addresses[i]);

-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.inka.de
    http://www.suse.de/~aj


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