Print statements with %d in trans-common.c

Andrew Pinski pinskia@physics.uc.edu
Tue Jan 11 22:42:00 GMT 2005


On Jan 11, 2005, at 5:36 PM, Steve Ellcey wrote:

> While looking around in fortran/trans-common.c I noticed that there are
> two print statements which print out a variable of type HOST_WIDE_INT
> (offset in translate_common, common_segment->offset in 
> translate_common)
> using a %d format.  This will not work right if HOST_WIDE_INT 
> translates
> to long and if long is a different size then int.  It will also not 
> work
> if HOST_WIDE_INT is long long and that type is a different size then
> int, which is the case I am seeing.
>
> Is there a standard way to handle this?  Truncating to int doesn't
> seem right.

HOST_WIDE_INT hello;
printf ("hello=" HOST_WIDE_INT_PRINT_DEC ";\n", hello);

-- Pinski



More information about the Fortran mailing list