libgccjit: Fix a bootstrap break for some targets.
authorIain Sandoe <iain@sandoe.co.uk>
Thu, 14 Apr 2022 19:08:14 +0000 (20:08 +0100)
committerIain Sandoe <iain@sandoe.co.uk>
Thu, 14 Apr 2022 19:15:55 +0000 (20:15 +0100)
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.

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

index b1e72fb..6be6bdf 100644 (file)
@@ -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);