From: Thomas Koenig Date: Sun, 14 Jun 2020 15:37:49 +0000 (+0200) Subject: Avoid crash when global symbol table is empty with -fdump-fortran-global. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3de12cc548c7a37bb68ea10937709dc6385a3b2b;p=gcc.git Avoid crash when global symbol table is empty with -fdump-fortran-global. This just avoids a crash with -fdump-fortran-global when the global symbol table is empty. This is strictly a developer's option, no user impact. gcc/fortran/ChangeLog: 2020-06-14 Thomas Koenig PR fortran/42122 * dump-parse-tree.c (gfc_dump_global_symbols): If the symroot is empty, just output "empty". --- diff --git a/gcc/fortran/dump-parse-tree.c b/gcc/fortran/dump-parse-tree.c index f32330685e7..f44648879f5 100644 --- a/gcc/fortran/dump-parse-tree.c +++ b/gcc/fortran/dump-parse-tree.c @@ -3595,5 +3595,8 @@ show_global_symbol (gfc_gsymbol *gsym, void *f_data) void gfc_dump_global_symbols (FILE *f) { - gfc_traverse_gsymbol (gfc_gsym_root, show_global_symbol, (void *) f); + if (gfc_gsym_root == NULL) + fprintf (f, "empty\n"); + else + gfc_traverse_gsymbol (gfc_gsym_root, show_global_symbol, (void *) f); }