From 18324422fdd790b0c11ba300a706a86df1023b74 Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Wed, 9 Jul 2025 18:30:09 +0200 Subject: [PATCH] Fix ICE in afdo_adjust_guessed_profile gcc/ChangeLog: * auto-profile.cc (afdo_adjust_guessed_profile): Add forgotten if (dump_file) guard. --- gcc/auto-profile.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/gcc/auto-profile.cc b/gcc/auto-profile.cc index e27bcc7b58d..219676012e7 100644 --- a/gcc/auto-profile.cc +++ b/gcc/auto-profile.cc @@ -3613,9 +3613,13 @@ afdo_adjust_guessed_profile (bb_set *annotated_bb) of hot basic blocks. */ if (max_count * scale > max_count_in_fn.guessed_local ()) { - fprintf (dump_file, "Scaling by %.16f produces max count ", scale.to_double ()); - (max_count * scale).dump (dump_file); - fprintf (dump_file, " that exceeds max count in fn; capping\n"); + if (dump_file) + { + fprintf (dump_file, "Scaling by %.16f produces max count ", + scale.to_double ()); + (max_count * scale).dump (dump_file); + fprintf (dump_file, " that exceeds max count in fn; capping\n"); + } scale = max_count_in_fn.guessed_local ().to_sreal_scale (max_count); } scale_bbs (bbs, scale); -- 2.47.2