From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by sourceware.org (Postfix) with ESMTPS id CA8B43858C50 for ; Tue, 19 Apr 2022 06:59:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CA8B43858C50 X-IronPort-AV: E=McAfee;i="6400,9594,10321"; a="263453423" X-IronPort-AV: E=Sophos;i="5.90,272,1643702400"; d="scan'208";a="263453423" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Apr 2022 23:59:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,272,1643702400"; d="scan'208";a="529192370" Received: from orsmsx605.amr.corp.intel.com ([10.22.229.18]) by orsmga006.jf.intel.com with ESMTP; 18 Apr 2022 23:59:14 -0700 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX605.amr.corp.intel.com (10.22.229.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Mon, 18 Apr 2022 23:59:14 -0700 Received: from orsmsx602.amr.corp.intel.com (10.22.229.15) by ORSMSX610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Mon, 18 Apr 2022 23:59:13 -0700 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27 via Frontend Transport; Mon, 18 Apr 2022 23:59:13 -0700 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (104.47.57.168) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.27; Mon, 18 Apr 2022 23:59:13 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bkt4CWOdbWMQCXoZx2kvlFvVBfiDTdt9f/4+FQ9KA845GLRljpJKeBqF4WimKnURYhqX7e9b1pxsUdj5MPb00MsjjlvJ8/lha5baOUInSL7kobA3t2noYIBMakZN7woDXPSUXuj0p601Xs/07gm7Prcd4F/FqzDKIzhvwEzZ3/Hz9wp1qZUQER7LC74Wxq+k0e43PBJhjEiEBWbsYTKWO/vJSXBpXOZ4TYfZtD/HJ5S3bjeWDqjnuDlA1+CRrRZL84GirV+pg5ZvwkJHeghgMLHn2uiP1l3ndB1EZviD5BOBcrv1MdA0T4uMjI+6Rmt23pq1jj3hZe7Rt7TFiCwxZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=T4gPkOmO1T3tzDfBcZmawgtM3x2nuU55KzRaGMGBDAw=; b=VxlWScFVauNACY6qUY3bMNJmNy4A90iYDmPkq/439wWdFA8MFI2X7Hnm2STzhnAPoShrlkc2C6dCJINOA0SDNhQ+rHm4lHtMkxgCJOre2PYkbLlipSnNR0nLw7YK53Q3k5Jl6NKjXJlE7Y/0RpL4KaqapHtHSJK3xaQt/TwlA67TOhKPVlY5NwMWEaDa/0QRM0Pt1V0pdFn053fl83miEdg5AYBBcDoqBcWrD0bNF6GYLk5wGQVUeeb9cuJsE8pyNJu2xQ+xBuhs00HQDEZMTiV5uNXKov8kewUUTdUTAFdxRlzxg4ztvxK5p3TBXwMsJA1GQ48jr4KTDD1jLzaGkA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from CY4PR1101MB2071.namprd11.prod.outlook.com (2603:10b6:910:1a::10) by CY4PR11MB1702.namprd11.prod.outlook.com (2603:10b6:903:2e::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5186.13; Tue, 19 Apr 2022 06:59:11 +0000 Received: from CY4PR1101MB2071.namprd11.prod.outlook.com ([fe80::99b6:62d4:b384:998]) by CY4PR1101MB2071.namprd11.prod.outlook.com ([fe80::99b6:62d4:b384:998%5]) with mapi id 15.20.5164.025; Tue, 19 Apr 2022 06:59:11 +0000 From: "Kempke, Nils-Christian" To: Tom Tromey , "Kempke, Nils-Christian via Gdb-patches" Subject: RE: [PATCH 2/2] gdb: Resolve dynamic target types of pointers. Thread-Topic: [PATCH 2/2] gdb: Resolve dynamic target types of pointers. Thread-Index: AQHYDG8c7kvyvhMx8kmJfwRdCntUeKyNVSWUgAjaHkCAW3+e8oAFrftQ Date: Tue, 19 Apr 2022 06:59:10 +0000 Message-ID: References: <20220118132626.3786176-1-nils-christian.kempke@intel.com> <20220118132626.3786176-3-nils-christian.kempke@intel.com> <87k0e2tsga.fsf@tromey.com> <87ee1y1fzn.fsf@tromey.com> In-Reply-To: <87ee1y1fzn.fsf@tromey.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.6.401.20 dlp-reaction: no-action x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: e9b54a77-ad38-4aec-4069-08da21d21b5d x-ms-traffictypediagnostic: CY4PR11MB1702:EE_ x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: yakgjRwuLkp+v5a1NM6tSVsxGARlVmCdTOncTfBmy9TKVyo9ALJqcq+z5j4tnkScxXgaevYshtUW1Ky5yfBiYi/EIBAoP6U1B+ApD6wgrB/lZhFdCCcp8fYeHAWYAlJlNAaPtuQZN4Ytukmw80h9ZthJP/ulWRKcQ1yTm1MlREPsAbZKxTtzDykUC+RGLOKeXrF204QexBhFFjxhB4o9j5/B6jA3EXTlj7Uo4YtHTV/MaqKjCwwMHXk2tXeGVMvE7m2lqCQXQo5tRvi0Uuh3ybJ/acxmGssVi+AD7XDoNAr5MNJU4Qywh/coucMzgmmVT3DOH27R408VGo768WIaung3XdWHHsu3Q1qap4ceb7Rc65SEiVs3NxsT8F/1LyPVrYBRtZ5RCiZ9BWeVC57K2a+lgyPR35JqeJcFfuft4SW4gVX3gxo6C6NDqJjH0ijLwwm7Im1PfzGZ/SOgNhxcm1XSijWWj+w4a3YX4dE9XGEfTKLe15YeYHjbb4j2kQqjj6a5Jutyi78gVUcBFWWEysVkAMAtnTp5EAnMcIy+nwLVtNaWCAMV8nYNUE9Kl49WgW7Bd1N547lvuU4CopX+BrHJpHyaQfnamI3wIr+z7Q8adHi/lZyikQqHWD79YYOsexOJ2jIb59Jmvo2dhtNr+JFV6y9nzo26e9kRu5T+LI62p/q8zw65xlca6HELLE9HQQNJ/QDkCyQOw5dFdwHZcw== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY4PR1101MB2071.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(8676002)(76116006)(64756008)(66556008)(66476007)(66946007)(86362001)(66446008)(38100700002)(122000001)(8936002)(5660300002)(52536014)(82960400001)(2906002)(508600001)(6506007)(38070700005)(186003)(83380400001)(9686003)(7696005)(110136005)(53546011)(71200400001)(316002)(33656002)(55016003); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 2 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?CudmIEWhnM5BFV+HfGSeFoBf5KyB176V39ysiXcmayC2q4+zEDc0W8V2K0h3?= =?us-ascii?Q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-antispam-messagedata-1: X1HbmCF01J8rRZ+dQFAMcoZEk5yY22uFimQ= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CY4PR1101MB2071.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: e9b54a77-ad38-4aec-4069-08da21d21b5d X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Apr 2022 06:59:11.0260 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: Q+X/RQ3UJ+PK0XaLMltWSIdfxap4ful8IOQMG8hH+sqKk/vHjN83Tnsjzu81PZG2d7H/lw54dM8EQpmpSyaMLM7OjzOnpgorLmcaYpIBn04= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR11MB1702 X-OriginatorOrg: intel.com Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Apr 2022 06:59:18 -0000 > -----Original Message----- > From: Tom Tromey > Sent: Friday, April 15, 2022 6:14 PM > To: Kempke, Nils-Christian via Gdb-patches > Cc: Tom Tromey ; Kempke, Nils-Christian christian.kempke@intel.com> > Subject: Re: [PATCH 2/2] gdb: Resolve dynamic target types of pointers. > = > > Thanks for the feedback. Sorry that it took me so long to reply - the m= ail > > somehow got lost.. > = > No need to apologize! I'm constantly months behind and/or dropping email. > = > >> > + if (type->code () =3D=3D TYPE_CODE_PTR && is_dynamic_type (type)) > >> > + { > >> > + CORE_ADDR addr; > >> > + if (nullptr !=3D TYPE_DATA_LOCATION (TYPE_TARGET_TYPE (type)= )) > >> > + addr =3D value_address (val); > >> > + else > >> > + addr =3D value_as_address (val); > >> > >> This seems weird to me. When does value_as_address fail? > = > > This if else has been introduced because of the way ifort/icc describe > pointers > > vs. gcc/gfortran and icx/ifx. > = > > <1> DW_TAG_variable > > <> DW_AT_type: > > <> DW_AT_location: (location of the pointer) > > <1> DW_TAG_pointer_type > > DW_AT_type: > > <1> DW_TAG_array_type > > <> DW_AT_type: > > <> DW_AT_data_location: (location of the array) > > <2> DW_TAG_subrange_type > = > > Fortran: > = > > <1> DW_TAG_variable > > <> DW_AT_type: > > <> DW_AT_location: (location of the pointer) > > <1> DW_TAG_array_type > > <> DW_AT_type: > > <> DW_AT_data_location: (location of the array) > > <2> DW_TAG_subrange_type > = > > When printing this pointer to array in gfortran/ifx the pointer print f= unction > is > > not actually called - since the DWARF does not emit a pointer here. > Instead, > > the normal array print is invoked which will use the DW_AT_data_locatio= n. > > So we do not run into this same problem > = > I still do not understand, sorry. > = > For me this looks like two different types. In one situation, the type > is a pointer to an array. In the second, it's just an array. So, I > would expect them to print differently. > = > Are you saying these should print identically? If so, that's fine -- > but then it seems like something to do in the Fortran code, not in > c-valprint.c. Yes, that is true. So, in Fortran pointers are just aliases for the underly= ing objects = > Maybe in the code the check for TYPE_DATA_LOCATION is a proxy for > checking that the pointer is a pointer to a Fortran array? I guess I > could understand that, but it doesn't seem like a good approach, because > what if some C compiler starts emitting this? > = > >> I'm curious why the code added here is not also needed in f-valprint.c. > = > > The reason here is simply that Fortran does not have this implemented f= or > > Itself. Instead the fortran f_langugage inherits from language_defn (t= he all > > languages base class) which simply delegates the value-print to > > c_value_print / so changing it there suffices. > = > If Fortran-specific printing is needed, this will have to change. > = > Tom Intel Deutschland GmbH Registered Address: Am Campeon 10, 85579 Neubiberg, Germany Tel: +49 89 99 8853-0, www.intel.de Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva = Chairperson of the Supervisory Board: Nicole Lau Registered Office: Munich Commercial Register: Amtsgericht Muenchen HRB 186928