public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
* [patch, fortran, committed] Small -fdump-fortran-original fixes, plus documentation update
@ 2017-10-08 12:57 Thomas Koenig
  2017-10-08 13:15 ` Paul Richard Thomas
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Koenig @ 2017-10-08 12:57 UTC (permalink / raw)
  To: fortran, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 724 bytes --]

Hello world,

I have committed a few small fixes for -fdump-fortran-original and
friends.

Since there was interest on c.l.f from somebdoy who actually wanted to
use the dump for something useful, I have also clarified in the docs
that this is something that is not guaranteed to work between releases.

Regards

	Thomas

2017-10-08  Thomas Koenig  <tkoenig@gcc.gnu.org>

         * dump_prase_tree (show_symbol): Output list of variables in
         NAMELIST.
         (show_code_node): Add new line for ELSE and END DO for DO
         CONCURRENT.
         * invoke.texi: Document that the output of
         -fdump-fortran-original, -fdump-fortran-optimized and
         -fdump-parse-tree is unsable and may lead to ICEs.

[-- Attachment #2: p2.diff --]
[-- Type: text/x-patch, Size: 3134 bytes --]

Index: dump-parse-tree.c
===================================================================
--- dump-parse-tree.c	(Revision 253381)
+++ dump-parse-tree.c	(Arbeitskopie)
@@ -967,8 +967,17 @@ show_symbol (gfc_symbol *sym)
       show_indent ();
       fputs ("PDT parameters", dumpfile);
       show_actual_arglist (sym->param_list);
+    }
 
+  if (sym->attr.flavor == FL_NAMELIST)
+    {
+      gfc_namelist *nl;
+      show_indent ();
+      fputs ("variables : ", dumpfile);
+      for (nl = sym->namelist; nl; nl = nl->next)
+	fprintf (dumpfile, " %s",nl->sym->name);
     }
+
   --show_level;
 }
 
@@ -1979,8 +1988,8 @@ show_code_node (int level, gfc_code *c)
       d = d->block;
       for (; d; d = d->block)
 	{
+	  fputs("\n", dumpfile);
 	  code_indent (level, 0);
-
 	  if (d->expr1 == NULL)
 	    fputs ("ELSE", dumpfile);
 	  else
@@ -2170,9 +2179,12 @@ show_code_node (int level, gfc_code *c)
             fputc (',', dumpfile);
         }
       show_expr (c->expr1);
+      ++show_level;
 
       show_code (level + 1, c->block->next);
+      --show_level;
       code_indent (level, c->label1);
+      show_indent ();
       fputs ("END DO", dumpfile);
       break;
 
Index: invoke.texi
===================================================================
--- invoke.texi	(Revision 253377)
+++ invoke.texi	(Arbeitskopie)
@@ -1120,20 +1120,28 @@ either your program or the GNU Fortran compiler.
 @item -fdump-fortran-original
 @opindex @code{fdump-fortran-original}
 Output the internal parse tree after translating the source program
-into internal representation.  Only really useful for debugging the
-GNU Fortran compiler itself.
+into internal representation.  This option is mostly useful for
+debugging the GNU Fortran compiler itself. The output generated by
+this option might change between releases. This option may also
+generate internal compiler errors for features which have only
+recently been added.
 
 @item -fdump-fortran-optimized
 @opindex @code{fdump-fortran-optimized}
-Output the parse tree after front-end optimization.  Only really
-useful for debugging the GNU Fortran compiler itself.
+Output the parse tree after front-end optimization.  Mostly useful for
+debugging the GNU Fortran compiler itself. The output generated by
+this option might change between releases.  This option may also
+generate internal compiler errors for features which have only
+recently been added.
 
 @item -fdump-parse-tree
 @opindex @code{fdump-parse-tree}
 Output the internal parse tree after translating the source program
-into internal representation.  Only really useful for debugging the
-GNU Fortran compiler itself.  This option is deprecated; use
-@code{-fdump-fortran-original} instead.
+into internal representation.  Mostly useful for debugging the GNU
+Fortran compiler itself. The output generated by this option might
+change between releases. This option may also generate internal
+compiler errors for features which have only recently been added. This
+option is deprecated; use @code{-fdump-fortran-original} instead.
 
 @item -ffpe-trap=@var{list}
 @opindex @code{ffpe-trap=}@var{list}

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [patch, fortran, committed] Small -fdump-fortran-original fixes, plus documentation update
  2017-10-08 12:57 [patch, fortran, committed] Small -fdump-fortran-original fixes, plus documentation update Thomas Koenig
@ 2017-10-08 13:15 ` Paul Richard Thomas
  2017-10-08 14:18   ` Thomas Koenig
  2017-10-08 14:46   ` Mikael Morin
  0 siblings, 2 replies; 4+ messages in thread
From: Paul Richard Thomas @ 2017-10-08 13:15 UTC (permalink / raw)
  To: Thomas Koenig; +Cc: fortran, gcc-patches

Hi Thomas,

I thought that the suggestion to add the original input lines was not
bad. It would be even better if -fdump-tree-original could do that. I
often time find myself putting a line under the spotlight in a
contained subroutine.

Thanks for working on -fdump-parse-tree.

Cheers

Paul

On 8 October 2017 at 13:57, Thomas Koenig <tkoenig@netcologne.de> wrote:
> Hello world,
>
> I have committed a few small fixes for -fdump-fortran-original and
> friends.
>
> Since there was interest on c.l.f from somebdoy who actually wanted to
> use the dump for something useful, I have also clarified in the docs
> that this is something that is not guaranteed to work between releases.
>
> Regards
>
>         Thomas
>
> 2017-10-08  Thomas Koenig  <tkoenig@gcc.gnu.org>
>
>         * dump_prase_tree (show_symbol): Output list of variables in
>         NAMELIST.
>         (show_code_node): Add new line for ELSE and END DO for DO
>         CONCURRENT.
>         * invoke.texi: Document that the output of
>         -fdump-fortran-original, -fdump-fortran-optimized and
>         -fdump-parse-tree is unsable and may lead to ICEs.



-- 
"If you can't explain it simply, you don't understand it well enough"
- Albert Einstein

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [patch, fortran, committed] Small -fdump-fortran-original fixes, plus documentation update
  2017-10-08 13:15 ` Paul Richard Thomas
@ 2017-10-08 14:18   ` Thomas Koenig
  2017-10-08 14:46   ` Mikael Morin
  1 sibling, 0 replies; 4+ messages in thread
From: Thomas Koenig @ 2017-10-08 14:18 UTC (permalink / raw)
  To: Paul Richard Thomas; +Cc: fortran, gcc-patches

Hi Paul,


> I thought that the suggestion to add the original input lines was not
> bad. It would be even better if -fdump-tree-original could do that. I
> often time find myself putting a line under the spotlight in a
> contained subroutine.

This should be doable.

What should be the perferred format?

Something like

filename:line\tOutput goes here

would be possible, or without the file name

line\tOutput goes here

The latter would have the advantage that it would be fairly easy to
line up the declarations from modules, which probably should not
have line number annotations.

And what would be preferred - having a new option to control line
numbering, or doing it unconditionally?

Regards

	Thomas

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [patch, fortran, committed] Small -fdump-fortran-original fixes, plus documentation update
  2017-10-08 13:15 ` Paul Richard Thomas
  2017-10-08 14:18   ` Thomas Koenig
@ 2017-10-08 14:46   ` Mikael Morin
  1 sibling, 0 replies; 4+ messages in thread
From: Mikael Morin @ 2017-10-08 14:46 UTC (permalink / raw)
  To: Paul Richard Thomas, Thomas Koenig; +Cc: fortran, gcc-patches

Hello,

Le 08/10/2017 à 15:15, Paul Richard Thomas a écrit :
> I thought that the suggestion to add the original input lines was not
> bad. It would be even better if -fdump-tree-original could do that.

There is -fdump-tree-original-lineno. I think it does that.

Cheers
Mikael

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-10-08 14:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-08 12:57 [patch, fortran, committed] Small -fdump-fortran-original fixes, plus documentation update Thomas Koenig
2017-10-08 13:15 ` Paul Richard Thomas
2017-10-08 14:18   ` Thomas Koenig
2017-10-08 14:46   ` Mikael Morin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).