--- gcc/pretty-print.h.jj	2023-09-06 14:36:53.485246347 +0200
+++ gcc/pretty-print.h	2023-09-08 11:11:21.173649942 +0200
@@ -333,28 +333,6 @@ pp_get_prefix (const pretty_printer *pp)
 #define pp_decimal_int(PP, I)  pp_scalar (PP, "%d", I)
 #define pp_unsigned_wide_integer(PP, I) \
    pp_scalar (PP, HOST_WIDE_INT_PRINT_UNSIGNED, (unsigned HOST_WIDE_INT) I)
-#define pp_wide_int(PP, W, SGN)					\
-  do								\
-    {								\
-      const wide_int_ref &pp_wide_int_ref = (W);		\
-      unsigned int pp_wide_int_prec				\
-	= pp_wide_int_ref.get_precision ();			\
-      if ((pp_wide_int_prec + 3) / 4				\
-	  > sizeof (pp_buffer (PP)->digit_buffer) - 3)		\
-	{							\
-	  char *pp_wide_int_buf					\
-	    = XALLOCAVEC (char, (pp_wide_int_prec + 3) / 4 + 3);\
-	  print_dec (pp_wide_int_ref, pp_wide_int_buf, SGN);	\
-	  pp_string (PP, pp_wide_int_buf);			\
-	}							\
-      else							\
-	{							\
-	  print_dec (pp_wide_int_ref,				\
-		     pp_buffer (PP)->digit_buffer, SGN);	\
-	  pp_string (PP, pp_buffer (PP)->digit_buffer);		\
-	}							\
-    }								\
-  while (0)
 #define pp_vrange(PP, R)					\
   do								\
     {								\
@@ -453,6 +431,19 @@ pp_wide_integer (pretty_printer *pp, HOS
   pp_scalar (pp, HOST_WIDE_INT_PRINT_DEC, i);
 }
 
+inline void
+pp_wide_int (pretty_printer *pp, const wide_int_ref &w, signop sgn)
+{
+  unsigned int prec = w.get_precision ();
+  if (UNLIKELY ((prec + 3) / 4 > sizeof (pp_buffer (pp)->digit_buffer) - 3))
+    pp_wide_int_large (pp, w, sgn);
+  else
+    {
+      print_dec (w, pp_buffer (pp)->digit_buffer, sgn);
+      pp_string (pp, pp_buffer (pp)->digit_buffer);
+    }
+}
+
 template<unsigned int N, typename T>
 void pp_wide_integer (pretty_printer *pp, const poly_int_pod<N, T> &);
 
--- gcc/wide-int-print.h.jj	2023-09-08 11:03:48.320944156 +0200
+++ gcc/wide-int-print.h	2023-09-08 11:11:46.982292282 +0200
@@ -34,5 +34,6 @@ extern void print_decu (const wide_int_r
 extern void print_decu (const wide_int_ref &wi, FILE *file);
 extern void print_hex (const wide_int_ref &wi, char *buf);
 extern void print_hex (const wide_int_ref &wi, FILE *file);
+extern void pp_wide_int_large (pretty_printer *, const wide_int_ref &, signop);
 
 #endif /* WIDE_INT_PRINT_H */
--- gcc/wide-int-print.cc.jj	2023-09-08 11:03:51.543898946 +0200
+++ gcc/wide-int-print.cc	2023-09-08 11:12:11.481952762 +0200
@@ -21,6 +21,7 @@ along with GCC; see the file COPYING3.
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
+#include "pretty-print.h"
 
 /*
  * public printing routines.
@@ -138,3 +139,14 @@ print_hex (const wide_int_ref &wi, FILE
   fputs (buf, file);
 }
 
+/* Print larger precision wide_int.  Not defined as inline in a header
+   together with pp_wide_int because XALLOCAVEC will make it uninlinable.  */
+
+void
+pp_wide_int_large (pretty_printer *pp, const wide_int_ref &w, signop sgn)
+{
+  unsigned int prec = w.get_precision ();
+  char *buf = XALLOCAVEC (char, (prec + 3) / 4 + 3);
+  print_dec (w, buf, sgn);
+  pp_string (pp, buf);
+}
