From 2d86d75105f6d2341ffec8bd78b4de972376d424 Mon Sep 17 00:00:00 2001 From: Thomas Koenig Date: Sun, 16 Jun 2019 08:34:31 +0000 Subject: [PATCH] dump_parse_tree (debug): Add verison for formal arglist. 2019-06-16 Thomas Koenig * dump_parse_tree (debug): Add verison for formal arglist. Do not crash when a gfc_expr is NULL. From-SVN: r272353 --- gcc/fortran/ChangeLog | 5 +++++ gcc/fortran/dump-parse-tree.c | 25 ++++++++++++++++++++++--- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 921a6fca551..d30fa2e50a8 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,8 @@ +2019-06-16 Thomas Koenig + + * dump_parse_tree (debug): Add verison for formal arglist. + Do not crash when a gfc_expr is NULL. + 2019-06-15 Steven G. Kargl * decl.c (gfc_match_derived_decl): Dummy argument cannot be a derived diff --git a/gcc/fortran/dump-parse-tree.c b/gcc/fortran/dump-parse-tree.c index 41b2c88265c..4cff8059b73 100644 --- a/gcc/fortran/dump-parse-tree.c +++ b/gcc/fortran/dump-parse-tree.c @@ -66,6 +66,19 @@ void debug (symbol_attribute *attr) dumpfile = tmp; } +void debug (gfc_formal_arglist *formal) +{ + FILE *tmp = dumpfile; + dumpfile = stderr; + for (; formal; formal = formal->next) + { + fputc ('\n', dumpfile); + show_symbol (formal->sym); + } + fputc ('\n', dumpfile); + dumpfile = tmp; +} + void debug (symbol_attribute attr) { debug (&attr); @@ -75,9 +88,15 @@ void debug (gfc_expr *e) { FILE *tmp = dumpfile; dumpfile = stderr; - show_expr (e); - fputc (' ', dumpfile); - show_typespec (&e->ts); + if (e != NULL) + { + show_expr (e); + fputc (' ', dumpfile); + show_typespec (&e->ts); + } + else + fputs ("() ", dumpfile); + fputc ('\n', dumpfile); dumpfile = tmp; } -- 2.30.2