public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [pushed] libgccjit: Fix a bootstrap break for some targets.
@ 2022-04-14 19:19 Iain Sandoe
  2022-04-19  8:01 ` Richard Biener
  0 siblings, 1 reply; 2+ messages in thread
From: Iain Sandoe @ 2022-04-14 19:19 UTC (permalink / raw)
  To: gcc-patches; +Cc: dmalcolm, bouanto

Some targets use 'long long unsigned int' for unsigned HW int, and this
leads to a Werror=format= fail for two print cases in jit-playback.cc
introduced in r12-8117-g30f7c83e9cfe (Add support for bitcasts [PR104071])

As discussed on IRC, casting to (long) seems entirely reasonable for the
values (since they are type sizes).

tested that this fixes bootstrap on x86_64-darwin19 and running check-jit.
pushed to master, thanks
Iain

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>

gcc/jit/ChangeLog:

	* jit-playback.cc (new_bitcast): Cast values returned by tree_to_uhwi
	to 'long' to match the print format.
---
 gcc/jit/jit-playback.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/jit/jit-playback.cc b/gcc/jit/jit-playback.cc
index b1e72fbcf8a..6be6bdf8dea 100644
--- a/gcc/jit/jit-playback.cc
+++ b/gcc/jit/jit-playback.cc
@@ -1440,10 +1440,10 @@ new_bitcast (location *loc,
     active_playback_ctxt->add_error (loc,
       "bitcast with types of different sizes");
     fprintf (stderr, "input expression (size: %ld):\n",
-      tree_to_uhwi (expr_size));
+      (long) tree_to_uhwi (expr_size));
     debug_tree (t_expr);
     fprintf (stderr, "requested type (size: %ld):\n",
-      tree_to_uhwi (type_size));
+      (long) tree_to_uhwi (type_size));
     debug_tree (t_dst_type);
   }
   tree t_bitcast = build1 (VIEW_CONVERT_EXPR, t_dst_type, t_expr);
-- 
2.24.3 (Apple Git-128)


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [pushed] libgccjit: Fix a bootstrap break for some targets.
  2022-04-14 19:19 [pushed] libgccjit: Fix a bootstrap break for some targets Iain Sandoe
@ 2022-04-19  8:01 ` Richard Biener
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2022-04-19  8:01 UTC (permalink / raw)
  To: Iain Sandoe; +Cc: GCC Patches, Iain Sandoe, bouanto

On Thu, Apr 14, 2022 at 9:19 PM Iain Sandoe via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> Some targets use 'long long unsigned int' for unsigned HW int, and this
> leads to a Werror=format= fail for two print cases in jit-playback.cc
> introduced in r12-8117-g30f7c83e9cfe (Add support for bitcasts [PR104071])
>
> As discussed on IRC, casting to (long) seems entirely reasonable for the
> values (since they are type sizes).
>
> tested that this fixes bootstrap on x86_64-darwin19 and running check-jit.
> pushed to master, thanks
> Iain
>
> Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
>
> gcc/jit/ChangeLog:
>
>         * jit-playback.cc (new_bitcast): Cast values returned by tree_to_uhwi
>         to 'long' to match the print format.
> ---
>  gcc/jit/jit-playback.cc | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/gcc/jit/jit-playback.cc b/gcc/jit/jit-playback.cc
> index b1e72fbcf8a..6be6bdf8dea 100644
> --- a/gcc/jit/jit-playback.cc
> +++ b/gcc/jit/jit-playback.cc
> @@ -1440,10 +1440,10 @@ new_bitcast (location *loc,
>      active_playback_ctxt->add_error (loc,
>        "bitcast with types of different sizes");
>      fprintf (stderr, "input expression (size: %ld):\n",
> -      tree_to_uhwi (expr_size));
> +      (long) tree_to_uhwi (expr_size));

You could use "size: " HOST_WIDE_INT_PRINT_DEC "):\n",
see hwint.h for the full set of formats available for HOST_WIDE_INT.

>      debug_tree (t_expr);
>      fprintf (stderr, "requested type (size: %ld):\n",
> -      tree_to_uhwi (type_size));
> +      (long) tree_to_uhwi (type_size));
>      debug_tree (t_dst_type);
>    }
>    tree t_bitcast = build1 (VIEW_CONVERT_EXPR, t_dst_type, t_expr);
> --
> 2.24.3 (Apple Git-128)
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-04-19  8:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-14 19:19 [pushed] libgccjit: Fix a bootstrap break for some targets Iain Sandoe
2022-04-19  8:01 ` 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).