From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B86213896C1A; Mon, 1 Mar 2021 11:28:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B86213896C1A From: "burnus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/99308] [OOP] passing array of object as class(TYPE) to procedure leads to incorrect length of array Date: Mon, 01 Mar 2021 11:28:32 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 10.2.0 X-Bugzilla-Keywords: missed-optimization, wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: burnus at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: keywords cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Mar 2021 11:28:32 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99308 Tobias Burnus changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |missed-optimization CC| |burnus at gcc dot gnu.org --- Comment #2 from Tobias Burnus --- I think there are two errors: (a) The value can be simplified at compile time as the size (8 or 2) is kno= wn at compile time, but isn't. I wonder whether this only a problem for 'size' or also for 'ubound','lboun= d' or when doing var(:)%idx =3D 0 =E2=80=93 for the bounds of the generated do loop. (b) The run-time version is wrong. In my dump, (and output '2 2') I see for either variable parm.10.span =3D spcs->_vptr->_size; parm.10.dtype =3D {.elem_len=3D4, .rank=3D1, .type=3D5}; D.3995 =3D stride.5; parm.10.dim[0].lbound =3D 1; parm.10.dim[0].ubound =3D 2; parm.10.dim[0].stride =3D NON_LVALUE_EXPR ; parm.10.data =3D 0B; parm.10.offset =3D -NON_LVALUE_EXPR ; D.3996 =3D &parm.10; D.3997 =3D (integer(kind=3D4)) MAX_EXPR <(D.3996->dim[0].ubound - D.3996->dim[0].lbound) + 1, 0>; Obviously, 'ubound =3D 2' is only valid for 'fuel' and not for 'spcs'.=