On Mon, 28 Mar 2022, Harald Anlauf via Gcc-patches wrote:

> Hi Tobias,
> 
> sorry for replying to myself now, but
> 
> Am 28.03.22 um 22:03 schrieb Harald Anlauf via Fortran:
> > All current cases of printing a HOST_WIDE_INT in gcc/fortran/ use
> > 'sprintf', and I did not find any other use of %wd/%wu.  So the
> > mentioned implementation is not really stressed yet... ;-)
> 
> using HOST_WIDE_INT_PRINT_DEC in the format argument to gfc_error
> instead of using %wd does not produce a warning and works.
> (Also verified with insane character lengths on x86_64).

Using string concatenation with a macro is not appropriate in a message 
argument to a diagnostic function, because it means the full string (which 
has to be host-independent) doesn't get extracted for translation.

HOST_WIDE_INT_PRINT_* are printf formats for the host printf function (for 
example, they might use %I64d on Windows host), and are not generally 
understood by the diagnostic.cc machinery at all; functions using the GCC 
diagnostic machinery need to use GCC diagnostic formats (which are 
independent of the host printf function), such as %wd/%wu.

-- 
Joseph S. Myers
jos...@codesourcery.com

Reply via email to