From patchwork Sun Jul 4 15:10:48 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Kraft X-Patchwork-Id: 57847 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 773E9B6F44 for ; Mon, 5 Jul 2010 01:06:48 +1000 (EST) Received: (qmail 3927 invoked by alias); 4 Jul 2010 15:06:45 -0000 Received: (qmail 3909 invoked by uid 22791); 4 Jul 2010 15:06:43 -0000 X-SWARE-Spam-Status: No, hits=-1.3 required=5.0 tests=AWL, BAYES_50, RCVD_IN_DNSWL_LOW, SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from taro.utanet.at (HELO taro.utanet.at) (213.90.36.45) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 04 Jul 2010 15:06:02 +0000 Received: from pam.xoc.tele2net.at ([213.90.36.6]) by taro.utanet.at with esmtp (Exim 4.71) (envelope-from ) id 1OVQlb-00063R-2j; Sun, 04 Jul 2010 17:05:59 +0200 Received: from d86-32-16-56.cust.tele2.at ([86.32.16.56] helo=[192.168.1.18]) by pam.xoc.tele2net.at with esmtpa (Exim 4.71) (envelope-from ) id 1OVQla-00082J-Qm; Sun, 04 Jul 2010 17:05:58 +0200 Message-ID: <4C30A478.8010402@domob.eu> Date: Sun, 04 Jul 2010 17:10:48 +0200 From: Daniel Kraft User-Agent: Thunderbird 2.0.0.0 (X11/20070425) MIME-Version: 1.0 To: Fortran List , gcc-patches Subject: [Patch, Fortran, Doc] Document BLOCK and ASSOCIATE in gfc-internals 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 Hi all, the attached patch adds some words about BLOCK and ASSOCIATE to gfc-internals.texi. Tested with make info. Ok for trunk? Yours, Daniel Index: gcc/fortran/gfc-internals.texi =================================================================== --- gcc/fortran/gfc-internals.texi (revision 161801) +++ gcc/fortran/gfc-internals.texi (working copy) @@ -406,6 +406,33 @@ case-block, and @code{extx.case_list} co corresponds to. The @code{block} member links to the next case in the list. +@subsection @code{BLOCK} and @code{ASSOCIATE} + +The code related to a @code{BLOCK} statement is stored inside an +@code{gfc_code} structure (say @var{c}) +with @code{c.op} set to @code{EXEC_BLOCK}. The +@code{gfc_namespace} holding the locally defined variables of the +@code{BLOCK} is stored in @code{c.ext.block.ns}. The code inside the +construct is in @code{c.code}. + +@code{ASSOCIATE} constructs are based on @code{BLOCK} and thus also have +the internal storage structure described above (including @code{EXEC_BLOCK}). +However, for them @code{c.ext.block.assoc} is set additionally and points +to a linked list of @code{gfc_association_list} structures. Those +structures basically store a link of associate-names to target expressions. +The associate-names themselves are still also added to the @code{BLOCK}'s +namespace as ordinary symbols, but they have their @code{gfc_symbol}'s +member @code{assoc} set also pointing to the association-list structure. +This way associate-names can be distinguished from ordinary variables +and their target expressions identified. + +For association to expressions (as opposed to variables), at the very beginning +of the @code{BLOCK} construct assignments are automatically generated to +set the corresponding variables to their target expressions' values, and +later on the compiler simply disallows using such associate-names in contexts +that may change the value. + + @c gfc_expr @c --------