Hi!

As mentioned in the PR, using HOST_WIDE_INT_PRINT_* in the middle of
translatable message is highly undesirable, we end up with:
#: config/s390/s390.c:737
#, gcc-internal-format
msgid "constant argument %d for builtin %qF is out of range (0.."
msgstr ""

#: config/s390/s390.c:754
#, gcc-internal-format
msgid "constant argument %d for builtin %qF is out of range ("
msgstr ""
in gcc.pot that way and nothing is translated.

The following patch should fix that by using proper %wu/%wd.
Tested by building a cross-compiler to s390x-linux, ok for trunk?

2019-03-07  Jakub Jelinek  <ja...@redhat.com>

        PR target/79846
        * config/s390/s390.c (s390_const_operand_ok): Use %wu instead of
        HOST_WIDE_INT_PRINT_UNSIGNED and %wd instead of
        HOST_WIDE_INT_PRINT_DEC.  Formatting fixes.

--- gcc/config/s390/s390.c.jj   2019-02-18 20:48:32.873728534 +0100
+++ gcc/config/s390/s390.c      2019-03-07 18:13:44.757949114 +0100
@@ -734,10 +734,9 @@ s390_const_operand_ok (tree arg, int arg
       if (!tree_fits_uhwi_p (arg)
          || tree_to_uhwi (arg) > (HOST_WIDE_INT_1U << bitwidth) - 1)
        {
-         error("constant argument %d for builtin %qF is out of range (0.."
-               HOST_WIDE_INT_PRINT_UNSIGNED ")",
-               argnum, decl,
-               (HOST_WIDE_INT_1U << bitwidth) - 1);
+         error ("constant argument %d for builtin %qF is out of range "
+                "(0..%wu)", argnum, decl,
+                (HOST_WIDE_INT_1U << bitwidth) - 1);
          return false;
        }
     }
@@ -751,12 +750,10 @@ s390_const_operand_ok (tree arg, int arg
          || tree_to_shwi (arg) < -(HOST_WIDE_INT_1 << (bitwidth - 1))
          || tree_to_shwi (arg) > ((HOST_WIDE_INT_1 << (bitwidth - 1)) - 1))
        {
-         error("constant argument %d for builtin %qF is out of range ("
-               HOST_WIDE_INT_PRINT_DEC ".."
-               HOST_WIDE_INT_PRINT_DEC ")",
-               argnum, decl,
-               -(HOST_WIDE_INT_1 << (bitwidth - 1)),
-               (HOST_WIDE_INT_1 << (bitwidth - 1)) - 1);
+         error ("constant argument %d for builtin %qF is out of range "
+                "(%wd..%wd)", argnum, decl,
+                -(HOST_WIDE_INT_1 << (bitwidth - 1)),
+                (HOST_WIDE_INT_1 << (bitwidth - 1)) - 1);
          return false;
        }
     }

        Jakub

Reply via email to