64 bit cross-compiler patch

Kaveh R. Ghazi ghazi@caip.rutgers.edu
Mon Jan 19 11:26:00 GMT 1998


 > From: John Carr <jfc@mit.edu>
 > Subject: 64 bit cross-compiler patch
 > 
 > 
 > This patch fixes a problem defining HOST_WIDE_INT as long long (which
 > is useful for cross compiling from a 32 bit system to a 64 bit
 > system).  I decided that requiring an ANSI C compiler for this case is
 > reasonable.  An alternative is to use multiple calls to printf.

John,

	Rather than add a third cpp clause below, I think your
alternative suggestion of using multiple calls to printf is much better. 
That way we have one version of the code that is tested and run on all
platforms, and no typos can lurk in a seldomly used clause.  Eg,
something like the following would work for all cases and we could
eliminate the cpp checks of __STDC__ and HOST_BITS_PER_WIDE_INT ==
HOST_BITS_PER_INT entirely. 


printf("XWINT (x%d, 0) == ", depth);
printf(HOST_WIDE_INT_PRINT_DEC, p->elt_zero_wide + offset);
printf("%s && ", offset ? "-1" : "");

		--Kaveh

 > Sun Jan 18 09:43:15 1998  John F. Carr  <jfc@mit.edu>
 > 
 > 	* genrecog.c (write_tree_1): Use correct printf format if
 > 	HOST_WIDE_INT is long long.
 > 
 > *** genrecog.c.egcs	Sun Nov  2 03:40:15 1997
 > --- genrecog.c	Sun Jan 18 09:50:37 1998
 > ***************
 > *** 1359,1369 ****
 > --- 1359,1373 ----
 >   	         for 1 << 31 .  */
 >   	      HOST_WIDE_INT offset = p->elt_zero_wide == -2147483647 - 1;
 >   	      printf (
 > + #ifdef __STDC__
 > + 		       "XWINT (x%d, 0) == " HOST_WIDE_INT_PRINT_DEC "%s && ",
 > + #else
 >   #if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
 >   		       "XWINT (x%d, 0) == %d%s && ",
 >   #else
 >   		       "XWINT (x%d, 0) == %ld%s && ",
 >   #endif
 > + #endif
 >   		       depth, p->elt_zero_wide + offset, offset ? "-1" : "");
 >   	    }
 >   	  if (p->veclen)
 > 
--
Kaveh R. Ghazi			Project Manager / Custom Development
ghazi@caip.rutgers.edu		ICon CMT Corp.



More information about the Gcc-bugs mailing list