From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2078.outbound.protection.outlook.com [40.107.244.78]) by sourceware.org (Postfix) with ESMTPS id 2FAA73858D37 for ; Sat, 22 Jan 2022 07:17:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2FAA73858D37 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UauZJI07jbwtr4ZReEOXsD7rg/Sn2yGBKgzlWZlb4G+pjtSNZhhZGW8IaxhwSPGGOzDE0s5nICpBfaEP9RzAW1t6St7jxHIloCMQ/2pQwqnghJ+AsV4He/ZPyLMTqLXwMgWVQwdJfQ2OghF0+Fh/cjk3r2PAm+rxWd7EWis3Nxjipu832wog9JoqrHrte3iM2iF4u8pzXjm9s42diD9Xv54pW9RmCS+dTjjaWOLXKPoB5Nq+SN9zrF0h//qfc/IbUK+NN47HnMHFH7HTphkqdF+tOCO+1Fkt9o5iKtjsd5cdjc561iBqJ/gy4gbEKnlhsZVlvMP7FWViRof5MJn6zQ== 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=qOaOVGfu6g4FtRLkvIzcJ/0Cfr1FzyUUx0ZRRksHR1c=; b=VkjoeIsLC070MvbBZAIiXPeiyQwdM/bVDAs+IlA1adey1zaPxmA7zttflA6BKeg9pKCR+r92TfUDoMLMsP3QNkgvQegEjoo9KEtL6kScHe5paEMaWGxzWkQkhQn7+VGdZeT+VjTcsd4HId/PjYeTnG/edX9xc9YlQPNkhKQuwZqmjfEx3dgsE73LmV5Uji90Sn43qhP4cPlKALa8LDYXSahmP/rP44Ce2cx18fSIILrtlNteqpiZEkJSxGWCo7PipUU+8hOyswuCgTipEdyJ8yhdGkLQppjH/Ix3taC0BSu+0rFkWiW19cBluprSK9enyX8bS2cLEcjiHy6ts2/Bbw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none Received: from DM6PR12MB4219.namprd12.prod.outlook.com (2603:10b6:5:217::14) by BN8PR12MB3028.namprd12.prod.outlook.com (2603:10b6:408:43::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4909.8; Sat, 22 Jan 2022 07:17:41 +0000 Received: from DM6PR12MB4219.namprd12.prod.outlook.com ([fe80::5c85:d592:4ffb:e119]) by DM6PR12MB4219.namprd12.prod.outlook.com ([fe80::5c85:d592:4ffb:e119%4]) with mapi id 15.20.4909.012; Sat, 22 Jan 2022 07:17:41 +0000 From: "Potharla, Rupesh" To: Andrew Burgess CC: "gdb-patches@sourceware.org" , "Achra, Nitika" , "Kaushik, Sharang" , "Natarajan, Kavitha" , "E, Nagajyothi" , "Kumar N, Bhuvanendra" , "George, Jini Susan" , "Parasuraman, Hariharan" , "Sharma, Alok Kumar" , "Balasubrmanian, Vignesh" Subject: RE: [PATCH] Support for Fortran's ASSUMED RANK Thread-Topic: [PATCH] Support for Fortran's ASSUMED RANK Thread-Index: AdgNXQtM8LEGEAevRfiMoU/ZVB5CwwBnQxuAABjtkbA= Date: Sat, 22 Jan 2022 07:17:40 +0000 Message-ID: References: <20220121190711.GM622389@redhat.com> In-Reply-To: <20220121190711.GM622389@redhat.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_88914ebd-7e6c-4e12-a031-a9906be2db14_Enabled=true; MSIP_Label_88914ebd-7e6c-4e12-a031-a9906be2db14_SetDate=2022-01-22T07:00:57Z; MSIP_Label_88914ebd-7e6c-4e12-a031-a9906be2db14_Method=Standard; MSIP_Label_88914ebd-7e6c-4e12-a031-a9906be2db14_Name=AMD Official Use Only-AIP 2.0; MSIP_Label_88914ebd-7e6c-4e12-a031-a9906be2db14_SiteId=3dd8961f-e488-4e60-8e11-a82d994e183d; MSIP_Label_88914ebd-7e6c-4e12-a031-a9906be2db14_ActionId=57fda632-b215-4354-a8ef-598fc59eef10; MSIP_Label_88914ebd-7e6c-4e12-a031-a9906be2db14_ContentBits=1 msip_label_88914ebd-7e6c-4e12-a031-a9906be2db14_enabled: true msip_label_88914ebd-7e6c-4e12-a031-a9906be2db14_setdate: 2022-01-22T07:17:38Z msip_label_88914ebd-7e6c-4e12-a031-a9906be2db14_method: Standard msip_label_88914ebd-7e6c-4e12-a031-a9906be2db14_name: AMD Official Use Only-AIP 2.0 msip_label_88914ebd-7e6c-4e12-a031-a9906be2db14_siteid: 3dd8961f-e488-4e60-8e11-a82d994e183d msip_label_88914ebd-7e6c-4e12-a031-a9906be2db14_actionid: 1664792c-7b40-48b2-a417-d53b30778a7a msip_label_88914ebd-7e6c-4e12-a031-a9906be2db14_contentbits: 0 x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: d23c54ce-08b6-46f9-7bc5-08d9dd7746ed x-ms-traffictypediagnostic: BN8PR12MB3028:EE_ x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2276; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: jbwFZb3Hz+NUrKkkrCvtAfNEcydrZWEJy+ukXAN/p3AxgkyxQrEBB6jsu8H4Vb4BymOPiKYMP6u5tMU7NuDKdc88p9neeRcZ0gg3xC6Q4ZiqinPWF9cnZKiBtD99Pfh4oI4M+sAly6x/ygWuNGMgLARRDBewSMfM4OWTxSOIORTuobfR2bVvKrhipcW1u9f16Rch7OYAzF7o3NZp/qaKqPIARRB0xmbXIX00FPzblIwOXE6pzFaYsdFGBRLoUZlGCoyqHyHAcDQT9X/HoWsm0UMvsnQDUa5oIH3UfrgCl/xaFMvc0S+26J/ALAu+N1Hu06CfbWD1U0xjxO7xMcMf7t346F/eeRQu3UJRumGhgtibfD2TsepPg/KA8jFxRW3vI4FiRv6OfJB6x0RVlGtMB+oxTBUcS19aEEtNkyOrWv23/uwzxZPmtBKRaI/sv652XZOSC7MS6kL58shSWMBDpoqYXS7rjfR/zEMM9OAEk9a714HP3khQQqQ0q/mMXqxJIwSTgXI1YaNEulnx7IRELBbYseYlo13E2URITqQZwwXizvC/k/JNfwqpLzBtemiK5b+xta2zNnGiRZXgG78j2YDIsmhmB1MC4xeErF4I03knTpP9K9dtDfgG4UPIQBhOycMJPzFHh7hX0jyEEN/MO38Nz+vdNRcwh+KKQMxB2Azvnvt+7VZFZTrMZznlg3/nbi96DWsqDhkZvFjF3aUiRYpjIKHOP3wRGw6ZFUCzEwXpShpA3zY9CQtFyX3MUWgGfEnTPgM4Oc8jJEx4uW2AgMDZxW53ZSfkvZlAsIKUAoeE4VTWPG0BR2Mc9PA8z0Vjp0g7FMaCVKd6QcKENH8pwWa4upRsPgnVfMgdW471Ses= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR12MB4219.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(4326008)(2906002)(6506007)(71200400001)(53546011)(8676002)(30864003)(83380400001)(26005)(508600001)(7696005)(52536014)(9686003)(316002)(66446008)(186003)(66946007)(33656002)(5660300002)(66556008)(76116006)(66476007)(54906003)(86362001)(38070700005)(122000001)(6916009)(64756008)(38100700002)(55016003)(8936002)(2004002)(579004)(559001); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?KvkhVMjxzpuITBhFuscNsDjq7zLY3I1haTJ/z9xImR9Vzm5u/1adVLcTfxgs?= =?us-ascii?Q?ieCLctJsLAindforJey3dBG1aEnvKI0lB5GUJ/yI4AHEFCU/JjogTOk5xjXK?= =?us-ascii?Q?VVwBqo/zGxgRiXSmH2tBIFk4krvo6oGdwJEr9KA7JNpKGbYgKgBA5f8rUTDJ?= =?us-ascii?Q?5SBNaYpX1ZnLneZFq8UQ8lud/0lJiOnb/3cW9dA1FWgH2vW6dpW/42fkK/6v?= =?us-ascii?Q?vj3ZI6dISc93Zw+BCLnHLiX7hQeRwNFjfAFy8vsZikTi3AzTemcDU5XmSVYD?= =?us-ascii?Q?mPiVikq71hnv05afxbvAPQUMc6lC3D0vilCowzJ9X55KDnIQ2eoyp0YP7TpV?= =?us-ascii?Q?FN3OGc5LRbv++lI+71tdhMvtoi2XHL0T7oM+hpG7b+O5mEoot+0jO08lm+ur?= =?us-ascii?Q?6bSMbVT1K8k1Z9spWVkfd3MNbPcy5GQRlskPPsUYl5TUhYP4Dzf9qNkg0deL?= =?us-ascii?Q?98qNG/sjLHdO12UbXDShhDHWaaD92Swl3+TyJnnVikDrTS207neqiZx0pwGm?= =?us-ascii?Q?MJFOrME7mKojpY9V/6bRL23v2d4OlIAvrJ6oVRKd/qWFA0R04/l51cLBgqT4?= =?us-ascii?Q?NXO8AhDHpOSpS3qxnrXxglRFXAyx26K2clttOjGyHcHArcetV5FTanuv3FbF?= =?us-ascii?Q?iT9JIEk05JE6W9+gWM6TfWT9tPaIIzKpt5Ssa8n1f8yMl4/WGMkbXCCFrJkM?= =?us-ascii?Q?5tjKvyG0XET7gGO6luTnCMFxaeN+LxhiSUt8tRbqUkXDCFwG1PxD2kbfvgsW?= =?us-ascii?Q?7VhXnwfMQ2bphSAOJnmAymBW5K2+RUqJvfoD61w1wg2MivvMDrWu7JHBJjQV?= =?us-ascii?Q?+ruHQAUoOGFouS4Z4JYHfsUDARhEQymOSRarj1HGvwqAX4FXl5e5vbCqU0uY?= =?us-ascii?Q?9CHMATusz4ntHjtXXEy9mzVtQei9m+F5RRM4sH12jkj5VOUf6sUOX8NffPiq?= =?us-ascii?Q?V3d0qzly6jNkG537m/x9zJb2PSIyWR+9F5yFyyPNw8rE/BhO5rffIiSL3WtU?= =?us-ascii?Q?ssehUArB35IPy7xesa+F+EcNXgVF82uA6WX4k5QkFn87+g58sKEQTaPowcI+?= =?us-ascii?Q?bkGVv0LbViMT+GNUaO+SnEv/RTT5wAanWvUK4o6GhWiZMTr5GnBn9N3mP5My?= =?us-ascii?Q?VAGSVb3GnmrVnqvKPHi7cMHBln4GkG+e1gyvUxGXC9CPksxfR1mFofecJ7Tf?= =?us-ascii?Q?Ic25ADZDULJysbYiBgIsfAqpWWiLROl1FlqPFzCbsqKdhQy4Pn2k0el4HiWC?= =?us-ascii?Q?AGtSojVpnB8ZvuBVVVAdZ0MM8YaUNI7mwENAZs6DJaxI5cxvoFsFwX4l7lTr?= =?us-ascii?Q?UZPimwel5b5H75/Z/zLxLmOTSoG3KOdwqWRg/obakFZ5iiLhqNsqRr6VhZvr?= =?us-ascii?Q?NbaaRSMYfrwTUAdJIlhKy67ssPmLYz/20laG9q9mcoDu15E52gw8BpoT6Sv9?= =?us-ascii?Q?+hA/jLtt1cvRjGGuTG5zTpngpwUZ5uNnQwT8AJ+z1E3sQgfRYZkWIllZKjXS?= =?us-ascii?Q?Af6gQQeUi5syllg66rWBiMcG1XaQ3gJ2pxWSgPRUZwsdSgSkUWS6qjPgyv/L?= =?us-ascii?Q?LraYIfSzlPqqPsWBibILIKS0W6gda1V832r03S1/p48fDbBotWssODYsiXby?= =?us-ascii?Q?zA=3D=3D?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM6PR12MB4219.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: d23c54ce-08b6-46f9-7bc5-08d9dd7746ed X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Jan 2022 07:17:40.7795 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 4AksU/+WZjXWK7lruQs/kbFsDXdeAaWbME5YE5+lE83cX772buD/IToT6kaynuyicLW5KUWN8MzTFkbjMbnHEA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR12MB3028 X-Spam-Status: No, score=-10.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, KAM_STOCKGEN, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP 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: Sat, 22 Jan 2022 07:17:49 -0000 [AMD Official Use Only] Hi Andrew, Thanks for the prompt. While working on this, I saw issues with gcc compile= r so I opened a gcc ticket (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D= 103315 )which recently fixed the issues with the compiler.=20 Regards, Rupesh P -----Original Message----- From: Andrew Burgess =20 Sent: Saturday, January 22, 2022 12:37 AM To: Potharla, Rupesh Cc: gdb-patches@sourceware.org; Achra, Nitika ; Kaush= ik, Sharang ; Natarajan, Kavitha ; E, Nagajyothi ; Kumar N, Bhuvanendra ; George, Jini Susan ; Pa= rasuraman, Hariharan ; Sharma, Alok Kumar ; Balasubrmanian, Vignesh Subject: Re: [PATCH] Support for Fortran's ASSUMED RANK [CAUTION: External Email] Thanks for working on this feature, having this in would be a great win! I'm a little short on time, so I only took a quick look through - I'll try = to do a full review next week, however, I did have some initial questions, = which would help with my review, see inline below... * Potharla, Rupesh via Gdb-patches [2022-01-19= 17:57:53 +0000]: > [AMD Official Use Only] > > Requesting to please review the attached patch. > > > This patch adds support for debugging assumed rank arrays of Fortran. > > Testcase used: > > PROGRAM arank > > REAL :: a1(10) > > CALL sub1(a1) > > CONTAINS > SUBROUTINE sub1(a) > REAL :: a(..) > PRINT *, RANK(a) > END > END > > Compiler Version: > gcc (GCC) 12.0.0 20211122 (experimental) I guess this must be something that was fixed recently, I tried with the 9.= 3 compiler I have locally and the tests failed. I also tried with some ran= dom build from git from early last year, and that also failed. Ideally the tests wont just fail when using older tools, but instead the te= st will detect that my compiler isn't good enough and just skip the tests, = so you might need to try with some older compilers. > > Compilation command: > gfortran assumedrank.f90 -gdwarf-5 -o assumedrank > > Without Patch: > > gdb -q assumedrank > Reading symbols from assumedrank... > (gdb) br sub1 > Breakpoint 1 at 0x4006ff: file assumedrank.f90, line 10. > (gdb) r > Starting program: /home/rupesh/STAGING-BUILD-2787/bin/assumedrank > > Breakpoint 1, arank::sub1 (a=3D) at assumedrank.f90:10 > 10 PRINT *, RANK(a) > (gdb) p RANK(a) > 'a' has unknown type; cast it to its declared type > > With patch : > gdb -q assumedrank > Reading symbols from assumedrank... > (gdb) br sub1 > Breakpoint 1 at 0x4006ff: file assumedrank.f90, line 10. > (gdb) r > Starting program: /home/rupesh/STAGING-BUILD-2787/bin/assumedrank > > Breakpoint 1, arank::sub1 (a=3D...) at assumedrank.f90:10 > 10 PRINT *, RANK(a) > (gdb) p RANK(a) > $1 =3D 1 > (gdb) ptype a > type =3D real(kind=3D4) (10) > (gdb) > > Regards, > Rupesh P > > > From 383c561a1e926b7b65a1d8ffb5d70a047a4d4559 Mon Sep 17 00:00:00 2001 > From: rupesh > Date: Fri, 29 Oct 2021 11:32:58 +0530 > Subject: [PATCH] Support for Fortran's ASSUMED RANK. > > This patch adds support for debugging assumed rank arrays of Fortran. > > Testcase used: > > PROGRAM arank > > REAL :: a1(10) > > CALL sub1(a1) > > CONTAINS > SUBROUTINE sub1(a) > REAL :: a(..) > PRINT *, RANK(a) > END > END > > Compiler Version: > gcc (GCC) 12.0.0 20211122 (experimental) > > Compilation command: > gfortran assumedrank.f90 -gdwarf-5 -o assumedrank > > Without Patch: > > gdb -q assumedrank > Reading symbols from assumedrank... > (gdb) br sub1 > Breakpoint 1 at 0x4006ff: file assumedrank.f90, line 10. > (gdb) r > Starting program: /home/rupesh/STAGING-BUILD-2787/bin/assumedrank > > Breakpoint 1, arank::sub1 (a=3D) at assumedrank.f90:10 > 10 PRINT *, RANK(a) > (gdb) p RANK(a) > 'a' has unknown type; cast it to its declared type > > With patch : > gdb -q assumedrank > Reading symbols from assumedrank... > (gdb) br sub1 > Breakpoint 1 at 0x4006ff: file assumedrank.f90, line 10. > (gdb) r > Starting program: /home/rupesh/STAGING-BUILD-2787/bin/assumedrank > > Breakpoint 1, arank::sub1 (a=3D...) at assumedrank.f90:10 > 10 PRINT *, RANK(a) > (gdb) p RANK(a) > $1 =3D 1 > (gdb) ptype a > type =3D real(kind=3D4) (10) > (gdb) > > gdb/ChangeLog: > > * dwarf2/loc.c: (dwarf2_locexpr_baton_eval): Push array dimension o= nto the stack. > * dwarf2/loc.h: Added an additional parameter to the function dwarf= 2_evaluate_property. > * dwarf2/read.c: (scan_partial_symbols): Process DW_TAG_generic_sub= range. > * (add_partial_symbol): Process DW_TAG_generic_subrange. > * (process_die): Process DW_TAG_generic_subrange. > * (is_type_tag_for_partial) : Check for DW_TAG_generic_subrange typ= e. > * (load_partial_dies): Load DW_TAG_generic_subrange. > * (new_symbol): Create entry for DW_TAG_generic_subrange type. > * (read_type_die_1): Read DW_TAG_generic_subrange type. > * (set_die_type) : Add dynamic property type for DW_AT_rank. > * f-typeprint.c: (f_type_print_varspec_suffix): Removed TYPE_DATA_L= OCATION. > * findvar.c: (follow_static_link): Passing new argument to the func= tion call dwarf2_evaluate_property. > * gdbtypes.c: (resolve_dynamic_range): Passing new argument to the = function call dwarf2_evaluate_property. > * (resolve_dynamic_array_or_string): Handle rank dynamic property b= y creating and removing types. > * gdbtypes.h: (DYN_PROP_RANK, TYPE_DYN_PROP, TYPE_RANK_PROP): New = Macros > * gnu-v3-abi.c: Passing new argument to the function call dwarf2_ev= aluate_property. > * testsuite/gdb.fortran/assumedrank.exp: New Testcase > * testsuite/gdb.fortran/assumedrank.f90: New Testcase ChangeLog entries are no longer needed for GDB, though you are welcome to h= ave content like this in the commit message if you like. That said, the pr= eference in GDB is to have the commit described within the main body of the= commit message - a ChangeLog formatted block should be in addition. You should still keep the lines under ~76ish characters though. > --- > gdb/dwarf2/loc.c | 10 ++- > gdb/dwarf2/loc.h | 4 ++ > gdb/dwarf2/read.c | 19 +++++- > gdb/f-typeprint.c | 4 +- > gdb/findvar.c | 2 +- > gdb/gdbtypes.c | 59 +++++++++++++---- > gdb/gdbtypes.h | 7 ++ > gdb/gnu-v3-abi.c | 2 +- > gdb/testsuite/gdb.fortran/assumedrank.exp | 79=20 > +++++++++++++++++++++++ > gdb/testsuite/gdb.fortran/assumedrank.f90 | 42 ++++++++++++ > 10 files changed, 209 insertions(+), 19 deletions(-) create mode=20 > 100644 gdb/testsuite/gdb.fortran/assumedrank.exp > create mode 100644 gdb/testsuite/gdb.fortran/assumedrank.f90 > > diff --git a/gdb/dwarf2/loc.c b/gdb/dwarf2/loc.c index=20 > 182f15e7077..60f831c2cff 100644 > --- a/gdb/dwarf2/loc.c > +++ b/gdb/dwarf2/loc.c > @@ -1547,7 +1547,8 @@ dwarf2_locexpr_baton_eval (const struct dwarf2_loce= xpr_baton *dlbaton, > const struct property_addr_info *addr_stack, > CORE_ADDR *valp, > bool push_initial_value, > - bool *is_reference) > + bool *is_reference, > + int rank) > { > if (dlbaton =3D=3D NULL || dlbaton->size =3D=3D 0) > return 0; > @@ -1559,6 +1560,10 @@ dwarf2_locexpr_baton_eval (const struct dwarf2_loc= expr_baton *dlbaton, > value *result; > scoped_value_mark free_values; > > + /* push rank value to the stack */ > + if (rank) > + ctx.push_address((rank - 1), false); > + I wonder, did you consider making use of the push_initial_value mechanism? > if (push_initial_value) > { > if (addr_stack !=3D nullptr) > @@ -1611,6 +1616,7 @@ dwarf2_evaluate_property (const struct dynamic_prop= *prop, > struct frame_info *frame, > const struct property_addr_info *addr_stack, > CORE_ADDR *value, > + int rank, > bool push_initial_value) { > if (prop =3D=3D NULL) > @@ -1629,7 +1635,7 @@ dwarf2_evaluate_property (const struct=20 > dynamic_prop *prop, > > bool is_reference =3D baton->locexpr.is_reference; > if (dwarf2_locexpr_baton_eval (&baton->locexpr, frame, addr_stack, > - value, push_initial_value, &is_refer= ence)) > + value, push_initial_value,=20 > + &is_reference, rank)) > { > if (is_reference) > { > diff --git a/gdb/dwarf2/loc.h b/gdb/dwarf2/loc.h index=20 > 5ff061bb4b6..66b35876da1 100644 > --- a/gdb/dwarf2/loc.h > +++ b/gdb/dwarf2/loc.h > @@ -114,6 +114,9 @@ struct property_addr_info > Returns true if PROP could be converted and the static value is passe= d > back into VALUE, otherwise returns false. > > + rank is pushed on to the stack before evaluating assumed rank array > + dimensions. > + > If PUSH_INITIAL_VALUE is true, then the top value of ADDR_STACK > will be pushed before evaluating a location expression. */ > > @@ -121,6 +124,7 @@ bool dwarf2_evaluate_property (const struct dynamic_p= rop *prop, > struct frame_info *frame, > const struct property_addr_info *addr_stack, > CORE_ADDR *value, > + int rank, > bool push_initial_value =3D false); > > /* A helper for the compiler interface that compiles a single dynamic=20 > diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index=20 > f2d7da7de52..05e1bc9c6c2 100644 > --- a/gdb/dwarf2/read.c > +++ b/gdb/dwarf2/read.c > @@ -7694,6 +7694,7 @@ scan_partial_symbols (struct partial_die_info *firs= t_die, CORE_ADDR *lowpc, > add_partial_enumeration (pdi, cu); > break; > case DW_TAG_base_type: > + case DW_TAG_generic_subrange: > case DW_TAG_subrange_type: > /* File scope base type definitions are added to the partial > symbol table. */ > @@ -8020,6 +8021,7 @@ add_partial_symbol (struct partial_die_info *pdi, s= truct dwarf2_cu *cu) > case DW_TAG_typedef: > case DW_TAG_base_type: > case DW_TAG_subrange_type: > + case DW_TAG_generic_subrange: > psymbol.domain =3D VAR_DOMAIN; > psymbol.aclass =3D LOC_TYPEDEF; > where =3D psymbol_placement::STATIC; @@ -9721,6 +9723,7 @@=20 > process_die (struct die_info *die, struct dwarf2_cu *cu) > /* FALLTHROUGH */ > case DW_TAG_base_type: > case DW_TAG_subrange_type: > + case DW_TAG_generic_subrange: > case DW_TAG_typedef: > /* Add a typedef symbol for the type definition, if it has a > DW_AT_name. */ > @@ -16612,7 +16615,8 @@ read_array_type (struct die_info *die, struct dwa= rf2_cu *cu) > child_die =3D die->child; > while (child_die && child_die->tag) > { > - if (child_die->tag =3D=3D DW_TAG_subrange_type) > + if (child_die->tag =3D=3D DW_TAG_subrange_type > + || child_die->tag =3D=3D DW_TAG_generic_subrange) > { > struct type *child_type =3D read_type_die (child_die, cu); > > @@ -18934,6 +18938,7 @@ is_type_tag_for_partial (int tag, enum language l= ang) > case DW_TAG_enumeration_type: > case DW_TAG_structure_type: > case DW_TAG_subrange_type: > + case DW_TAG_generic_subrange: > case DW_TAG_typedef: > case DW_TAG_union_type: > return 1; > @@ -19067,6 +19072,7 @@ load_partial_dies (const struct die_reader_specs = *reader, > && ((pdi.tag =3D=3D DW_TAG_typedef && !pdi.has_children) > || pdi.tag =3D=3D DW_TAG_base_type > || pdi.tag =3D=3D DW_TAG_array_type > + || pdi.tag =3D=3D DW_TAG_generic_subrange > || pdi.tag =3D=3D DW_TAG_subrange_type)) > { > if (building_psymtab && pdi.raw_name !=3D NULL) @@ -21989,6=20 > +21995,7 @@ new_symbol (struct die_info *die, struct type *type, struct d= warf2_cu *cu, > case DW_TAG_array_type: > case DW_TAG_base_type: > case DW_TAG_subrange_type: > + case DW_TAG_generic_subrange: > SYMBOL_ACLASS_INDEX (sym) =3D LOC_TYPEDEF; > SYMBOL_DOMAIN (sym) =3D VAR_DOMAIN; > list_to_add =3D cu->list_in_scope; @@ -22482,6 +22489,7 @@=20 > read_type_die_1 (struct die_info *die, struct dwarf2_cu *cu) > case DW_TAG_typedef: > this_type =3D read_typedef (die, cu); > break; > + case DW_TAG_generic_subrange: > case DW_TAG_subrange_type: > this_type =3D read_subrange_type (die, cu); > break; > @@ -24767,6 +24775,15 @@ set_die_type (struct die_info *die, struct type = *type, struct dwarf2_cu *cu, > type->add_dyn_prop (DYN_PROP_ASSOCIATED, prop); > } > > + /* Read DW_AT_rank and set in type */ attr =3D dwarf2_attr (die,=20 > + DW_AT_rank, cu); if (attr !=3D NULL) > + { > + struct type *prop_type =3D cu->addr_sized_int_type (false); > + if (attr_to_dynamic_prop (attr, die, cu, &prop, prop_type)) > + type->add_dyn_prop (DYN_PROP_RANK, prop); > + } > + > /* Read DW_AT_data_location and set in type. */ > if (!skip_data_location) > { > diff --git a/gdb/f-typeprint.c b/gdb/f-typeprint.c index=20 > 1791cb29451..95500e930ba 100644 > --- a/gdb/f-typeprint.c > +++ b/gdb/f-typeprint.c > @@ -177,9 +177,7 @@ f_language::f_type_print_varspec_suffix (struct type = *type, > else if ((TYPE_ASSOCIATED_PROP (type) > && PROP_CONST !=3D TYPE_ASSOCIATED_PROP (type)->kind ()) > || (TYPE_ALLOCATED_PROP (type) > - && PROP_CONST !=3D TYPE_ALLOCATED_PROP (type)->kind ()) > - || (TYPE_DATA_LOCATION (type) > - && PROP_CONST !=3D TYPE_DATA_LOCATION (type)->kind ())) > + && PROP_CONST !=3D TYPE_ALLOCATED_PROP (type)->kind=20 > + ())) > { > /* This case exist when we ptype a typename which has the dynamic > properties but cannot be resolved as there is no object. =20 > */ diff --git a/gdb/findvar.c b/gdb/findvar.c index=20 > a0031d2dadd..a1c25323bc6 100644 > --- a/gdb/findvar.c > +++ b/gdb/findvar.c > @@ -440,7 +440,7 @@ follow_static_link (struct frame_info *frame, { > CORE_ADDR upper_frame_base; > > - if (!dwarf2_evaluate_property (static_link, frame, NULL,=20 > &upper_frame_base)) > + if (!dwarf2_evaluate_property (static_link, frame, NULL, =20 > + &upper_frame_base, 0)) > return NULL; > > /* Now climb up the stack frame until we reach the frame we are=20 > interested diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index=20 > 00934d9a4bc..227b7af2c1b 100644 > --- a/gdb/gdbtypes.c > +++ b/gdb/gdbtypes.c > @@ -2196,6 +2196,7 @@ static struct type=20 > *resolve_dynamic_type_internal static struct type * =20 > resolve_dynamic_range (struct type *dyn_range_type, > struct property_addr_info *addr_stack, > + int curr_rank, > bool resolve_p =3D true) { > CORE_ADDR value; > @@ -2205,13 +2206,13 @@ resolve_dynamic_range (struct type *dyn_range_typ= e, > gdb_assert (dyn_range_type->code () =3D=3D TYPE_CODE_RANGE); > > const struct dynamic_prop *prop =3D &dyn_range_type->bounds ()->low; > - if (resolve_p && dwarf2_evaluate_property (prop, NULL, addr_stack,=20 > &value)) > + if (resolve_p && dwarf2_evaluate_property (prop, NULL, addr_stack,=20 > + &value, curr_rank)) > low_bound.set_const_val (value); > else > low_bound.set_undefined (); > > prop =3D &dyn_range_type->bounds ()->high; > - if (resolve_p && dwarf2_evaluate_property (prop, NULL, addr_stack,=20 > &value)) > + if (resolve_p && dwarf2_evaluate_property (prop, NULL, addr_stack,=20 > + &value, curr_rank)) > { > high_bound.set_const_val (value); > > @@ -2224,7 +2225,7 @@ resolve_dynamic_range (struct type=20 > *dyn_range_type, > > bool byte_stride_p =3D dyn_range_type->bounds ()->flag_is_byte_stride; > prop =3D &dyn_range_type->bounds ()->stride; > - if (resolve_p && dwarf2_evaluate_property (prop, NULL, addr_stack,=20 > &value)) > + if (resolve_p && dwarf2_evaluate_property (prop, NULL, addr_stack,=20 > + &value, curr_rank)) > { > stride.set_const_val (value); > > @@ -2272,8 +2273,12 @@ resolve_dynamic_array_or_string (struct type *type= , > struct type *elt_type; > struct type *range_type; > struct type *ary_dim; > + struct type *tmp_type; > + struct type *element_type; > struct dynamic_prop *prop; > unsigned int bit_stride =3D 0; > + unsigned int i; > + static int rank =3D 0; > > /* For dynamic type resolution strings can be treated like arrays of > characters. */ > @@ -2293,7 +2298,7 @@ resolve_dynamic_array_or_string (struct type *type, > dimension of the array. */ > prop =3D TYPE_ALLOCATED_PROP (type); > if (prop !=3D NULL && resolve_p > - && dwarf2_evaluate_property (prop, NULL, addr_stack, &value)) > + && dwarf2_evaluate_property (prop, NULL, addr_stack, &value,=20 > + 0)) > { > prop->set_const_val (value); > if (value =3D=3D 0) > @@ -2302,15 +2307,47 @@ resolve_dynamic_array_or_string (struct type=20 > *type, > > prop =3D TYPE_ASSOCIATED_PROP (type); > if (prop !=3D NULL && resolve_p > - && dwarf2_evaluate_property (prop, NULL, addr_stack, &value)) > + && dwarf2_evaluate_property (prop, NULL, addr_stack, &value,=20 > + 0)) > { > prop->set_const_val (value); > if (value =3D=3D 0) > resolve_p =3D false; > } > > + /* Resolve the rank property to get rank value. If rank is zero or is = of > + variable type remove the array type from the linked list. If the ra= nk > + is greater than 1 add more array types to the list based on rank va= lue > + to hold multi dimensional array information. */ > + prop =3D TYPE_RANK_PROP (type); > + if (!rank && prop !=3D NULL && resolve_p > + && dwarf2_evaluate_property (prop, NULL, addr_stack, &value, 0)) > + { > + prop->set_const_val (value); > + if (value =3D=3D 0) > + { > + resolve_p =3D false; > + TYPE_DYN_PROP(TYPE_TARGET_TYPE(type)) =3D TYPE_DYN_PROP(type); > + type =3D TYPE_TARGET_TYPE(type); > + return type; > + } > + else > + { > + rank =3D value; > + tmp_type =3D type; > + element_type =3D TYPE_TARGET_TYPE(tmp_type); > + for (i =3D 1; i < rank; i++) > + { > + TYPE_TARGET_TYPE(tmp_type) =3D copy_type(tmp_type); > + tmp_type =3D TYPE_TARGET_TYPE(tmp_type); > + } > + TYPE_TARGET_TYPE(tmp_type) =3D element_type; > + } > + } > + > range_type =3D check_typedef (type->index_type ()); > - range_type =3D resolve_dynamic_range (range_type, addr_stack,=20 > resolve_p); > + range_type =3D resolve_dynamic_range (range_type, addr_stack, rank,=20 > + resolve_p); if (rank) > + rank--; > > ary_dim =3D check_typedef (TYPE_TARGET_TYPE (type)); > if (ary_dim !=3D NULL && ary_dim->code () =3D=3D TYPE_CODE_ARRAY) @@=20 > -2321,7 +2358,7 @@ resolve_dynamic_array_or_string (struct type *type, > prop =3D type->dyn_prop (DYN_PROP_BYTE_STRIDE); > if (prop !=3D NULL && resolve_p) > { > - if (dwarf2_evaluate_property (prop, NULL, addr_stack, &value)) > + if (dwarf2_evaluate_property (prop, NULL, addr_stack, &value,=20 > + 0)) > { > type->remove_dyn_prop (DYN_PROP_BYTE_STRIDE); > bit_stride =3D (unsigned int) (value * 8); @@ -2597,7 +2634,7 @@= =20 > resolve_dynamic_struct (struct type *type, > prop.set_locexpr (&baton); > > CORE_ADDR addr; > - if (dwarf2_evaluate_property (&prop, nullptr, addr_stack, &addr, > + if (dwarf2_evaluate_property (&prop, nullptr, addr_stack,=20 > + &addr, 0, > true)) > resolved_type->field (i).set_loc_bitpos > (TARGET_CHAR_BIT * (addr - addr_stack->addr)); @@ -2682,7=20 > +2719,7 @@ resolve_dynamic_type_internal (struct type *type, > gdb::optional type_length; > prop =3D TYPE_DYNAMIC_LENGTH (type); > if (prop !=3D NULL > - && dwarf2_evaluate_property (prop, NULL, addr_stack, &value)) > + && dwarf2_evaluate_property (prop, NULL, addr_stack, &value,=20 > + 0)) > type_length =3D value; > > if (type->code () =3D=3D TYPE_CODE_TYPEDEF) @@ -2727,7 +2764,7 @@=20 > resolve_dynamic_type_internal (struct type *type, > break; > > case TYPE_CODE_RANGE: > - resolved_type =3D resolve_dynamic_range (type, addr_stack); > + resolved_type =3D resolve_dynamic_range (type, addr_stack, 0); > break; > > case TYPE_CODE_UNION: > @@ -2752,7 +2789,7 @@ resolve_dynamic_type_internal (struct type *type, > /* Resolve data_location attribute. */ > prop =3D TYPE_DATA_LOCATION (resolved_type); > if (prop !=3D NULL > - && dwarf2_evaluate_property (prop, NULL, addr_stack, &value)) > + && dwarf2_evaluate_property (prop, NULL, addr_stack, &value,=20 > + 0)) > { > /* Start of Fortran hack. See comment in f-lang.h for what is goi= ng > on here.*/ > diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index=20 > 5284a4c3a03..374f7e9e1f6 100644 > --- a/gdb/gdbtypes.h > +++ b/gdb/gdbtypes.h > @@ -556,6 +556,10 @@ enum dynamic_prop_node_kind > /* A property holding variant parts. */ > DYN_PROP_VARIANT_PARTS, > > + /* A property representing DW_AT_rank. The presence of this attribute > + indicates that the object is of assumed rank array type. */ =20 > + DYN_PROP_RANK, > + > /* A property holding the size of the type. */ > DYN_PROP_BYTE_SIZE, > }; > @@ -2035,6 +2039,7 @@ extern void allocate_gnat_aux_type (struct type=20 > *); #define TYPE_REFERENCE_TYPE(thistype) (thistype)->reference_type =20 > #define TYPE_RVALUE_REFERENCE_TYPE(thistype)=20 > (thistype)->rvalue_reference_type #define TYPE_CHAIN(thistype)=20 > (thistype)->chain > +#define TYPE_DYN_PROP(thistype) =20 > +TYPE_MAIN_TYPE(thistype)->dyn_prop_list > /* * Note that if thistype is a TYPEDEF type, you have to call check_typ= edef. > But check_typedef does set the TYPE_LENGTH of the TYPEDEF type, > so you only have to call check_typedef once. Since allocate_value=20 > @@ -2077,6 +2082,8 @@ extern bool set_type_align (struct type *, ULONGEST= ); > ((thistype)->dyn_prop (DYN_PROP_ALLOCATED)) #define=20 > TYPE_ASSOCIATED_PROP(thistype) \ > ((thistype)->dyn_prop (DYN_PROP_ASSOCIATED)) > +#define TYPE_RANK_PROP(thistype) \ > + ((thistype)->dyn_prop (DYN_PROP_RANK)) > > /* C++ */ > > diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c index=20 > 187c10595ac..e42e20148f4 100644 > --- a/gdb/gnu-v3-abi.c > +++ b/gdb/gnu-v3-abi.c > @@ -483,7 +483,7 @@ gnuv3_baseclass_offset (struct type *type, int=20 > index, > > CORE_ADDR result; > if (dwarf2_evaluate_property (&prop, nullptr, &addr_stack, &result= , > - true)) > + 0, true)) > return (int) (result - addr_stack.addr); > } > > diff --git a/gdb/testsuite/gdb.fortran/assumedrank.exp=20 > b/gdb/testsuite/gdb.fortran/assumedrank.exp > new file mode 100644 > index 00000000000..e3961d00278 > --- /dev/null > +++ b/gdb/testsuite/gdb.fortran/assumedrank.exp > @@ -0,0 +1,79 @@ > +# Copyright 2021 Free Software Foundation, Inc. > + > +# This program is free software; you can redistribute it and/or=20 > +modify # it under the terms of the GNU General Public License as=20 > +published by # the Free Software Foundation; either version 3 of the=20 > +License, or # (at your option) any later version. > +# > +# This program is distributed in the hope that it will be useful, #=20 > +but WITHOUT ANY WARRANTY; without even the implied warranty of #=20 > +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU=20 > +General Public License for more details. > +# > +# You should have received a copy of the GNU General Public License #=20 > +along with this program. If not, see . > + > +# Testing GDB's implementation of ASSUMED RANK. > + > +if {[skip_fortran_tests]} { return -1 } > + > +standard_testfile ".f90" > +load_lib fortran.exp > + > +if {[prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \ > + {debug f90}]} { In your commit message you made use of the -dwarf-5 flag. Is that required= ? I was surprised that this flag doesn't appear here. There's a couple of tests where we pass 'additional_flags=3D-gdwarf-5', but= you might only need to do this if the compiler is gfortran, and maybe for = particular versions? I'll try to take a detailed look through next week. Thanks, Andrew > + return -1 > +} > + > +if ![fortran_runto_main] { > + untested "could not run to main" > + return -1 > +} > + > +gdb_breakpoint [gdb_get_line_number "Test Breakpoint"] gdb_breakpoint=20 > +[gdb_get_line_number "Final Breakpoint"] > + > +# We place a limit on the number of tests that can be run, just in #=20 > +case something goes wrong, and GDB gets stuck in an loop here. > +set found_final_breakpoint false > +set test_count 0 > +while { $test_count < 500 } { > + with_test_prefix "test $test_count" { > + incr test_count > + > + gdb_test_multiple "continue" "continue" { > + -re -wrap "! Test Breakpoint" { > + # We can run a test from here. > + } > + -re "! Final Breakpoint" { > + # We're done with the tests. > + set found_final_breakpoint true > + } > + } > + > + if ($found_final_breakpoint) { > + break > + } > + > + # First grab the expected answer. > + set answer [get_valueof "" "rank(answer)" "**unknown**"] > + > + # Now move up a frame and figure out a command for us to run > + # as a test. > + set command "" > + gdb_test_multiple "up" "up" { > + -re -wrap "\r\n\[0-9\]+\[ \t\]+call test_rank (\[^\r\n\]+)" { > + set command $expect_out(1,string) > + } > + } > + > + gdb_assert { ![string equal $command ""] } "found a command to run" > + > + gdb_test "p rank($command)" " =3D ($answer)" > + } > +} > + > +# Ensure we reached the final breakpoint. If more tests have been=20 > +added # to the test script, and this starts failing, then the safety 'wh= ile' > +# loop above might need to be increased. > +gdb_assert {$found_final_breakpoint} "ran all compiled in tests" > diff --git a/gdb/testsuite/gdb.fortran/assumedrank.f90=20 > b/gdb/testsuite/gdb.fortran/assumedrank.f90 > new file mode 100644 > index 00000000000..53b4d7fc35d > --- /dev/null > +++ b/gdb/testsuite/gdb.fortran/assumedrank.f90 > @@ -0,0 +1,42 @@ > +! Copyright 2021 Free Software Foundation, Inc. > +! > +! This program is free software; you can redistribute it and/or=20 > +modify ! it under the terms of the GNU General Public License as=20 > +published by ! the Free Software Foundation; either version 3 of the=20 > +License, or ! (at your option) any later version. > +! > +! This program is distributed in the hope that it will be useful, !=20 > +but WITHOUT ANY WARRANTY; without even the implied warranty of !=20 > +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU=20 > +General Public License for more details. > +! > +! You should have received a copy of the GNU General Public License !=20 > +along with this program. If not, see . > + > +! > +! Start of test program. > +! > + > + > +PROGRAM arank > + > +REAL :: array1(10) > +REAL :: array2(1, 2) > +REAL :: array3(3, 4, 5) > +REAL :: array4(4, 5, 6, 7) > + > +call test_rank (array1) > +call test_rank (array2) > +call test_rank (array3) > +call test_rank (array4) > + > +print *, "" ! Final Breakpoint > + > +CONTAINS > + SUBROUTINE test_rank(answer) > + REAL :: answer(..) > + print *, RANK(answer) ! Test Breakpoint > + END > + > +END PROGRAM arank > + > -- > 2.17.1