public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Thomas Koenig <tkoenig@netcologne.de>
To: "fortran@gcc.gnu.org" <fortran@gcc.gnu.org>,
	 gcc-patches <gcc-patches@gcc.gnu.org>
Subject: [patch, fortran, committed] Fix display of BLOCK variables in Fortran dumps
Date: Sat, 30 Apr 2011 21:48:00 -0000	[thread overview]
Message-ID: <4DBC7BC1.6080806@netcologne.de> (raw)

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

Hello world,

I committed the attached patch as obvious (revision 173223) after
regression-testing.  No test case because we can't do that for the
Fortran dumps (yet).

With this patch, variables inside a BLOCK construct are displayed with 
their attributes, for example

program main
   block
     real, dimension(2) :: x
   end block
end program main

is now displayed as

Namespace: A-H: (REAL 4) I-N: (INTEGER 4) O-Z: (REAL 4)
procedure name = main
   symtree: 'main'        || symbol: 'main'
     type spec : (UNKNOWN 0)
     attributes: (PROGRAM PUBLIC  SUBROUTINE)

   code:

   BLOCK
     symtree: 'block@1'     || symbol: 'block@1'
       type spec : (UNKNOWN 0)
       attributes: (LABEL )
     symtree: 'x'           || symbol: 'x'
       type spec : (REAL 4)
       attributes: (VARIABLE  DIMENSION)
       Array spec:(1 [0] AS_EXPLICIT 1 2 )
   END BLOCK

instead as being displayed as being 'from block@1'.

	Thomas

2011-04-30  Thomas Koenig  <tkoenig@gcc.gnu.org>

         * dump-prase-tree.c (show_code_node):  Set the current
         namespace to the BLOCK before displaying it; restore
         afterwards.

[-- Attachment #2: block-1.diff --]
[-- Type: text/x-patch, Size: 726 bytes --]

Index: dump-parse-tree.c
===================================================================
--- dump-parse-tree.c	(Revision 173214)
+++ dump-parse-tree.c	(Arbeitskopie)
@@ -1440,6 +1440,8 @@ show_code_node (int level, gfc_code *c)
     case EXEC_BLOCK:
       {
 	const char* blocktype;
+	gfc_namespace *saved_ns;
+
 	if (c->ext.block.assoc)
 	  blocktype = "ASSOCIATE";
 	else
@@ -1448,7 +1450,10 @@ show_code_node (int level, gfc_code *c)
 	fprintf (dumpfile, "%s ", blocktype);
 	++show_level;
 	ns = c->ext.block.ns;
+	saved_ns = gfc_current_ns;
+	gfc_current_ns = ns;
 	gfc_traverse_symtree (ns->sym_root, show_symtree);
+	gfc_current_ns = saved_ns;
 	show_code (show_level, ns->code);
 	--show_level;
 	show_indent ();

                 reply	other threads:[~2011-04-30 21:15 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4DBC7BC1.6080806@netcologne.de \
    --to=tkoenig@netcologne.de \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).