From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B20073858C2C; Tue, 4 Jan 2022 11:32:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B20073858C2C From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/103691] [12 Regression] ICE in get_array_ctor_element_at_index, at fold-const.c:13314 since r12-4694-gcb153222404e2e14 Date: Tue, 04 Jan 2022 11:32:54 +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: 12.0 X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 12.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: 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: Tue, 04 Jan 2022 11:32:54 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103691 Jakub Jelinek changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #4 from Jakub Jelinek --- To me it looks like the PR52329 change wasn't correct. In particular, it should have been using true as the second argument and not false and theref= ore should have been removed in the r12-21-g0bf8cd9d5e8ac changes rather than k= ept. If I modify the testcase from a(0) to a(2), then I see pr103691.f90.037t.fre1: # DEBUG D.4293 =3D> &a[0] and pr103691.f90.038t.evrp: # DEBUG D.4293 =3D> &2.0e+0 The &2.0e+0 is just a wrong-debug, debug info was supposed to contain addre= ss of a, not address of some constant that happens to be in the first element of = the array. fold_stmt_1 earlier has: case GIMPLE_DEBUG: if (gimple_debug_bind_p (stmt)) { tree *val =3D gimple_debug_bind_get_value_ptr (stmt); if (*val && (REFERENCE_CLASS_P (*val) || TREE_CODE (*val) =3D=3D ADDR_EXPR) && maybe_canonicalize_mem_ref_addr (val, true)) changed =3D true; } which I believe should perform whatever PR52329 was meant to deal with. So I think else if (val && TREE_CODE (val) =3D=3D ADDR_EXPR) { tree ref =3D TREE_OPERAND (val, 0); tree tem =3D maybe_fold_reference (ref); if (tem) { tem =3D build_fold_addr_expr_with_type (tem, TREE_TYPE (v= al)); gimple_debug_bind_set_value (stmt, tem); changed =3D true; } } should be just dropped.=