From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mout.gmx.net (mout.gmx.net [212.227.17.21]) by sourceware.org (Postfix) with ESMTPS id AF749385800C; Sun, 10 Oct 2021 19:27:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org AF749385800C X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from gluon.fritz.box ([79.251.0.70]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1M5wLT-1mfOq5164J-007XSg; Sun, 10 Oct 2021 21:27:10 +0200 Subject: Re: [Patch] Fortran: Various CLASS + assumed-rank fixed [PR102541] To: Tobias Burnus , gcc-patches , fortran Newsgroups: gmane.comp.gcc.fortran,gmane.comp.gcc.patches References: From: Harald Anlauf Message-ID: <6c3386a2-0d52-d15a-0aff-d8435e2cbbae@gmx.de> Date: Sun, 10 Oct 2021 21:27:02 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:VNuwNN7Hg9kAhur6KBu3AlVOFbMpj6atmByupUWOebHcTW4nY6g VIitX3lUQ1x/15HLtURvaNMq3CRT6IjdKiId2FcR+aUT0mMCqt1xCLRPmoaVPEUXNs4MRZG eMK0iegNb9czk/XGrCkTYGG8W6xoaLwDSiWClHAdLBTW83TR5lubMpTJ3ScYf2uDbKHtH9z AKBYUASfZQMajUOdPp2Mw== X-UI-Out-Filterresults: notjunk:1;V03:K0:np22qHiPbEQ=:tzd2cLXjvCTaBEsN+7RZwo aVjfBlx++p/uApHt9Ep1fuCxi/jYd2dJIbmqfKvGYn9cvSMGXD9K8orZdLQX3oYFL1VXmwDJi k6QSOPy8jExn+WrEml8zt7ayxuCT4iTCbskFuLUnIFuDKy/gGeqNYOl7mwLdsQT58hY5uwqFr 2J1xre5/qoelvvnHXj418hJubpa8WoVrcfshUo8+zB06VXTl71KNScmMamppQePz1/AEwphJz 4UXP9YOr8fvMi5ruF8LLfrj4Ky29SXH08TV6yYF9/x5ORxz4/TCkfG3QSLPikH+GfTMFdwS/m kFVVQV4UfPXE1yuT+/HQJOl9MYMzgNWh8xWAVkNUAwbSlZu2a/O0gp1wWbchz4OUQO3Af8TQb ARbVHZYQJfei9Rq0CTS3sl8puBdHTjgryj+R9RHQcX3V/PRDgOrBONGWSx3fHQMouKEsnn5Xn /gxp2u1sprQLpFOGCOTkF+WcS/1Be8Rnm8VAHw6OQE5f881maaEt5rWyLSbfUGHA2BGf/hRvq rU9n+IbUbBEUWgBKC94fMeOqZvruXiXMhjw8V7fiHztq/qCtaajpGgqJYT3TUx6XWIFzQ/Gwv y1BKwRnIsvUZItEywjcu9wB1st4p3U+k30NPiaO9T4PMLAP81ybgt0XtsIhnlEcSjPchXp5ri 5QtFF16+kMgKi3o+3Wh3CUyepsLwMRjhSmvh4iBxzff60XekMg6HfdjKUtKcghGI4syFysBWi Ipg9FB2Po+JkLbPn4e8J6PlII/CxTupLntAcmIgcaaoZflzM0v+hn1pzUb2Zl8kgNVdg6U+9X 5Pd20iANj+6lvJl08A457u7oAZhseF1Ez2zVp6hzVxVjKe0wGTOVCFQhtfqUTcviTH07F5xu3 ms8vehKseM/+K8IG0DMcQt77mZQTk3Y9rtKZKXoBxI9GUtGPPwaM2vQVQO15zfPhyglIEz5HI /CxxpXjszu8R4jxc2JrSPk27b7S1jDaEi4FXHlOCYEOTpupLPAefvo8yNq8Ws1BwOuGpdkYzk vwyxCD9PhAWIHSRVKSAyyLXkBMcXxb9Hs8Gi+JRUbu4ypDW00XUdkc3vVcRSBCmlrsUgBGYPm y9quacYC+/5zes= X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM, GIT_PATCH_0, NICE_REPLY_A, SPF_HELO_NONE, 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: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Oct 2021 19:27:17 -0000 Hi Tobias, just some random remarks from initially browsing your patch. - leftover from debugging? diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c index 1c24556c299..8a82e55d1f9 100644 =2D-- a/gcc/fortran/trans-expr.c +++ b/gcc/fortran/trans-expr.c @@ -1,3 +1,4 @@ +#pragma GCC optimize(0) - code that could be shortened/made slightly more readable: @@ -2723,7 +2728,13 @@ gfc_variable_attr (gfc_expr *expr, gfc_typespec *ts= ) else { codimension =3D comp->attr.codimension; - pointer =3D comp->attr.pointer; + if (expr->ts.type =3D=3D BT_CLASS + && comp->name[0] =3D=3D '_' && comp->name[1] =3D=3D 'd' + && comp->name[2] =3D=3D 'a' && comp->name[3] =3D=3D 't' + && comp->name[4] =3D=3D 'a' && comp->name[5] =3D=3D '\0') Is there a reason to not use strcmp (comp->name, "_data") =3D=3D 0? Cheers, Harald Am 01.10.21 um 02:43 schrieb Tobias Burnus: > Hi all, > > this patch fixes a bunch of issues with CLASS. > > =C2=A0* * * > > Side remark: I disliked the way CLASS is represented when it was > introduced; > when writing the testcase for this PR and kept fixing the testcase fallo= ut, > I started to hate it! > I am sure that there are more issues =E2=80=93 but I tried hard not too = look closer > at surrounding code to avoid hitting more issues. > (If you look for a project, I think if you put attributes on separate > lines, > like a separate "POINTER :: var" line, you have a high chance to hit the > error.) > > =C2=A0* * * > > What I found rather puzzling is that the 'optional' argument could be > either > on sym->attr.optional or on CLASS_DATA (sym)->attr.optional. I think one > occurs for 'foo2' and the other for 'foo4' - not that I understand why i= t > differs. > > I think it is otherwise straight forward. Regarding the original issue: > > In order to detect an assumed-size argument to an assumed-rank array, > the last dimension has 'ubound =3D -1' to indicate an assume-size array; > for those size(x, dim=3Drank(x)-1) =3D=3D -1 and size(x) < 0 > > However, when the dummy argument (and hence: actual argument) is either > a pointer or an allocatable, the bound is passed as is (in particular, > "-1" is a valid ubound and size(x) >=3D 0). =E2=80=93 However, if the ac= tual > argument is unallocated/not associated, rank(var) still is supposed to > work - hence, it has to be set. > > The last two items did work before - but not for CLASS -> CLASS. > Additionally, > the ubound =3D -1 had an issue for CLASS -> TYPE as the code assumed tha= t > expr->ref is the whole array ("var(full-array-ref)") but for CLASS the > expr->ref is a component and only expr->ref->next is the array ref. > ("var%_data(full-array-ref)"). > > OK for mainline? > > Tobias > > ----------------- > Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstra=C3=9Fe = 201, > 80634 M=C3=BCnchen; Gesellschaft mit beschr=C3=A4nkter Haftung; Gesch=C3= =A4ftsf=C3=BChrer: > Thomas Heurung, Frank Th=C3=BCrauf; Sitz der Gesellschaft: M=C3=BCnchen; > Registergericht M=C3=BCnchen, HRB 106955