From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 39878 invoked by alias); 5 Jul 2016 15:31:30 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 39866 invoked by uid 89); 5 Jul 2016 15:31:29 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.9 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy=nicole, Nicole, H*RU:HELO, Hx-spam-relays-external:HELO X-HELO: mga11.intel.com Received: from mga11.intel.com (HELO mga11.intel.com) (192.55.52.93) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 05 Jul 2016 15:31:18 +0000 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP; 05 Jul 2016 08:31:16 -0700 X-ExtLoop1: 1 Received: from heckel-mobl3.ger.corp.intel.com (HELO [172.28.205.46]) ([172.28.205.46]) by fmsmga001.fm.intel.com with ESMTP; 05 Jul 2016 08:31:16 -0700 Subject: Re: [PATCH V2 3/5] Fortran: Resolve dynamic target types of pointers. To: Joel Brobecker References: <1467625943-21294-1-git-send-email-bernhard.heckel@intel.com> <1467625943-21294-4-git-send-email-bernhard.heckel@intel.com> <20160705143544.GG3295@adacore.com> Cc: qiyaoltc@gmail.com, eliz@gnu.org, gdb-patches@sourceware.org From: Bernhard Heckel Message-ID: <577BD2C1.5050409@intel.com> Date: Tue, 05 Jul 2016 15:31:00 -0000 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <20160705143544.GG3295@adacore.com> Content-Type: text/plain; charset="windows-1252"; format="flowed" Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2016-07/txt/msg00071.txt.bz2 On 05/07/2016 16:35, Joel Brobecker wrote: >> Dynamic target types of pointers have to be resolved before >> they can be further processed. If not, GDB wil show wrong >> boundaries, size,... or even crash as it will access some >> random memory. >> >> 2016-06-30 Bernhard Heckel >> >> gdb/Changelog: >> * NEWS: Added new fortran feature. >> * gdbtypes.c (resolve_dynamic_pointer_types): Resolve >> dynamic target types. >> * valops.c (value_ind): Throw error when pointer is >> not associated. >> >> gdb/Testsuite/Changelog: >> * gdb.fortran/pointers.f90: Add dynamic variables. >> * gdb.fortran/pointers.exp: Test dynamic variables. >> * gdb.fortran/print_type.exp: Test pointer to dynamic >> types. > I am wondering if this might be causing problems or unnecessary > resolutions. For instance, at least for languages such as Ada, > you don't really need to resolve the pointer type's target type > when just trying to print the pointer's value. In my experience, > this is the type of thing that should be done at type/value printing > time, or when dereferencing the pointer (Eg. during expression > evaluation). > Hi Joel, we could resolve the target when we actually access it -> value_ind. As far as I know there is one corner case, when we print the address and=20 the target type has an DATA_LOCATION attribute. But I don't find the code at the moment. Nevertheless, with your input it is becomes questionable if we should=20 resolve structures and references. Fields of structures could be resolved when we access them ->=20 value_struct_elt. What do you think? Let me take a second look on this... BR Bernhard Intel Deutschland GmbH Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany Tel: +49 89 99 8853-0, www.intel.de Managing Directors: Christin Eisenschmid, Christian Lamprechter Chairperson of the Supervisory Board: Nicole Lau Registered Office: Munich Commercial Register: Amtsgericht Muenchen HRB 186928