This dump message is not guarded on dump_file being non-NULL, so crashes
inside of libc if dump_file is NULL.
I think a message like that is usually guarded not just on dump_file
being non-NULL, but also on TDF_DETAILS set in dump_flags.
2026-01-22 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/123736
* tree-ssa-loop-unswitch.cc (hoist_guard): Guard dump message
on dump_file && (dump_flags & TDF_DETAILS) condition.
if (skip_count > e->count ())
{
- fprintf (dump_file, " Capping count; expect profile inconsistency\n");
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, " Capping count; expect profile inconsistency\n");
skip_count = e->count ();
}
if (dump_enabled_p ())