64bit cleanup in flow.c

Kaveh R. Ghazi ghazi@caip.rutgers.edu
Fri Dec 31 16:38:00 GMT 1999


 > From: Jeffrey A Law <law@cygnus.com>
 >  
 >  
 >   In message < 199912090402.XAA15460@polya.math.purdue.edu >you write:
 >   > 
 >   > This fixes a problem with argument size not matchine format size
 >   > in flow.c (the difference of pointers is a long).
 >  
 > No, the difference of pointer is not a long.  It is a ptrdiff_t.
 > Consider targets where a long is 64bits, but pointers are only 32bits.
 >  
 > There are some macros in the compiler to deal with printing pointer
 > values.  They should be used.  Search for PRINTF in system.h.
 > jeff


AFAIK, none of the macros defined in system.h or elsewhere deal with
printing ptrdiff_t.

Up till now, to correctly printf a ptrdiff_t, we use %ld and cast the
ptrdiff_t value to (long).  That DTRT in all combinations of type
sizes.

		--Kaveh

--- flow.c~	Sat Dec  4 07:41:17 1999
+++ flow.c	Thu Dec  9 12:35:10 1999
@@ -6430,12 +6430,12 @@ flow_loops_dump (loops, file, verbose)
 
       fprintf (file, ";; loop %d (%d to %d):\n"
 	       ";;   header %d, latch %d, pre-header %d,"
-	       " depth %d, level %d, outer %d\n",
+	       " depth %d, level %d, outer %ld\n",
 	       i, INSN_UID (loop->header->head), INSN_UID (loop->latch->end),
 	       loop->header->index, loop->latch->index,
 	       loop->pre_header ? loop->pre_header->index : -1, 
 	       loop->depth, loop->level,
-	       loop->outer ? (loop->outer - loops->array) : -1);
+	       (long) (loop->outer ? (loop->outer - loops->array) : -1));
       fprintf (file, ";;   %d", loop->num_nodes);
       flow_nodes_print (" nodes", loop->nodes, file);
       fprintf (file, ";;   %d", loop->num_exits);



More information about the Gcc-patches mailing list