* [PATCH] Fix a config/s390/s390.c diagnostics bug (PR target/79846)
@ 2019-03-07 19:56 Jakub Jelinek
2019-03-08 10:40 ` Richard Biener
0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2019-03-07 19:56 UTC (permalink / raw)
To: Andreas Krebbel; +Cc: gcc-patches
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 <jakub@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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Fix a config/s390/s390.c diagnostics bug (PR target/79846)
2019-03-07 19:56 [PATCH] Fix a config/s390/s390.c diagnostics bug (PR target/79846) Jakub Jelinek
@ 2019-03-08 10:40 ` Richard Biener
0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2019-03-08 10:40 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: Andreas Krebbel, GCC Patches
On Thu, Mar 7, 2019 at 8:53 PM Jakub Jelinek <jakub@redhat.com> wrote:
>
> 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?
OK.
Richard.
> 2019-03-07 Jakub Jelinek <jakub@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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-03-08 10:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-07 19:56 [PATCH] Fix a config/s390/s390.c diagnostics bug (PR target/79846) Jakub Jelinek
2019-03-08 10:40 ` Richard Biener
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).