From patchwork Sat Apr 30 21:14:41 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Koenig X-Patchwork-Id: 93523 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 93701B6F57 for ; Sun, 1 May 2011 07:15:04 +1000 (EST) Received: (qmail 19174 invoked by alias); 30 Apr 2011 21:15:00 -0000 Received: (qmail 19158 invoked by uid 22791); 30 Apr 2011 21:14:59 -0000 X-SWARE-Spam-Status: No, hits=-0.8 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from cc-smtpout2.netcologne.de (HELO cc-smtpout2.netcologne.de) (89.1.8.212) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 30 Apr 2011 21:14:44 +0000 Received: from cc-smtpin2.netcologne.de (cc-smtpin2.netcologne.de [89.1.8.202]) by cc-smtpout2.netcologne.de (Postfix) with ESMTP id 016051277A; Sat, 30 Apr 2011 23:14:43 +0200 (CEST) Received: from [192.168.0.197] (xdsl-78-35-158-218.netcologne.de [78.35.158.218]) by cc-smtpin2.netcologne.de (Postfix) with ESMTPSA id D544A11E8A; Sat, 30 Apr 2011 23:14:41 +0200 (CEST) Message-ID: <4DBC7BC1.6080806@netcologne.de> Date: Sat, 30 Apr 2011 23:14:41 +0200 From: Thomas Koenig User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.9.2.14) Gecko/20110221 SUSE/3.1.8 Thunderbird/3.1.8 MIME-Version: 1.0 To: "fortran@gcc.gnu.org" , gcc-patches Subject: [patch, fortran, committed] Fix display of BLOCK variables in Fortran dumps Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org 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 * dump-prase-tree.c (show_code_node): Set the current namespace to the BLOCK before displaying it; restore afterwards. 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 ();