statistics.cc: Add check to see if fn is not NULL in get_function_name.
authorPrathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
Thu, 7 Jul 2022 16:33:35 +0000 (22:03 +0530)
committerPrathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
Thu, 7 Jul 2022 16:35:09 +0000 (22:05 +0530)
gcc/ChangeLog:

* statistics.cc (get_function_name): Add check to see if fn is not NULL.

gcc/statistics.cc

index 6c21415..01ad353 100644 (file)
@@ -121,7 +121,7 @@ static const char *
 get_function_name (struct function *fn)
 {
   if ((statistics_dump_flags & TDF_ASMNAME)
-      && DECL_ASSEMBLER_NAME_SET_P (fn->decl))
+      && fn && DECL_ASSEMBLER_NAME_SET_P (fn->decl))
     {
       tree asmname = decl_assembler_name (fn->decl);
       if (asmname)