diff mbox series

[fortran,committed] Improve internal compiler debugging

Message ID 96f40de0-d2f0-f754-56e3-7c73459266a0@netcologne.de
State New
Headers show
Series [fortran,committed] Improve internal compiler debugging | expand

Commit Message

Thomas Koenig June 16, 2019, 8:41 a.m. UTC
Hi,

I just committed the attached patch as obvious ans simple. No impact
on user code, just to make internal debugging easier.

Regards

	Thomas

2019-06-16  Thomas Koenig  <tkoenig@gcc.gnu.org>

	* dump_parse_tree (debug): Add verison for formal arglist.
	Do not crash when a gfc_expr is NULL.
diff mbox series

Patch

Index: dump-parse-tree.c
===================================================================
--- dump-parse-tree.c	(Revision 271945)
+++ dump-parse-tree.c	(Arbeitskopie)
@@ -66,6 +66,19 @@ 
   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 @@ 
 {
   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;
 }