Comments
Patch
===================================================================
@@ -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 ();
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.