From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D5F2F3858C74; Fri, 26 Jan 2024 20:20:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D5F2F3858C74 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1706300439; bh=kXLGozCZ3HoDQqCSQZ941DrHplhZ3yNlSNCKWumc9Z8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=FGvBIDTLrLtF4zPKcISzbX6q5okeEcDMMOTUyXwFib8+76Y3P6ST0SJGQbEy310JX 7BABCzNYSKV9fxjHPVhWSiVPoRadg4cIi1cia5BeBitRaNA0v1xj2Odexso1lYHUXQ a1Rtw1gOcYvn9YtcenGM3Oto/loBkhmF47Cd60dM= From: "anlauf at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/104908] [11/12/13/14 Regression] incorrect Fortran out-of-bound runtime error. Date: Fri, 26 Jan 2024 20:20:37 +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: 11.2.0 X-Bugzilla-Keywords: ice-on-valid-code, wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: anlauf at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P4 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.5 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D104908 --- Comment #6 from anlauf at gcc dot gnu.org --- Studying the cases that ICE (CLASS array dummy) and testcase PR95331.f90 which fixes an unlimited polymorphic problem, I tried the following change: diff --git a/gcc/fortran/trans-array.cc b/gcc/fortran/trans-array.cc index f6ddce2d023..be7d42ff847 100644 --- a/gcc/fortran/trans-array.cc +++ b/gcc/fortran/trans-array.cc @@ -4097,7 +4097,10 @@ gfc_conv_array_ref (gfc_se * se, gfc_array_ref * ar, gfc_expr *expr, } decl =3D se->expr; - if (IS_CLASS_ARRAY (sym) && sym->attr.dummy && ar->as->type !=3D AS_DEFE= RRED) + if (UNLIMITED_POLY(sym) + && IS_CLASS_ARRAY (sym) + && sym->attr.dummy + && ar->as->type !=3D AS_DEFERRED) decl =3D sym->backend_decl; cst_offset =3D offset =3D gfc_index_zero_node; This is currently regtesting.=