diff options
author | Thomas Koenig <tkoenig@gcc.gnu.org> | 2020-06-14 17:37:49 +0200 |
---|---|---|
committer | Thomas Koenig <tkoenig@gcc.gnu.org> | 2020-06-14 17:38:31 +0200 |
commit | 3de12cc548c7a37bb68ea10937709dc6385a3b2b (patch) | |
tree | 272fd81ed22f3d04d3dbe0913ff0aa5b26688e52 /gcc/fortran/dump-parse-tree.c | |
parent | 3ee9d82484bdc0ae5b1b21f4a3d8ff46d40e36fd (diff) | |
download | gcc-3de12cc548c7a37bb68ea10937709dc6385a3b2b.zip gcc-3de12cc548c7a37bb68ea10937709dc6385a3b2b.tar.gz gcc-3de12cc548c7a37bb68ea10937709dc6385a3b2b.tar.bz2 |
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 <tkoenig@gcc.gnu.org>
PR fortran/42122
* dump-parse-tree.c (gfc_dump_global_symbols): If the symroot is
empty, just output "empty".
Diffstat (limited to 'gcc/fortran/dump-parse-tree.c')
-rw-r--r-- | gcc/fortran/dump-parse-tree.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/fortran/dump-parse-tree.c b/gcc/fortran/dump-parse-tree.c index f323306..f446488 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); } |