From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 2C5B438515E6; Tue, 11 May 2021 08:31:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2C5B438515E6 From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/100508] ICE with '-g -O3': in expand_debug_locations, at cfgexpand.c:5618 Date: Tue, 11 May 2021 08:31:50 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: ice-on-valid-code, openmp X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub 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: 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, 11 May 2021 08:31:51 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D100508 --- Comment #3 from Jakub Jelinek --- If you change it to #pragma omp declare simd it will start certainly earlie= r. I think the bug is in the inliner. Before dse1 we have: V m; : m_2 =3D j; # DEBUG m =3D> m_2 and dse1 turns that into: # DEBUG D#1 =3D> j # DEBUG m =3D> D#1 But it seems the inliner doesn't remap the DEBUG_EXPR_DECLs, which means th= ey are shared between different functions, and during expansion the correspond= ing DEBUG_EXPRs are shared between the functions too: case DEBUG_EXPR_DECL: op0 =3D DECL_RTL_IF_SET (exp); if (op0) return op0; op0 =3D gen_rtx_DEBUG_EXPR (mode); DEBUG_EXPR_TREE_DECL (op0) =3D exp; SET_DECL_RTL (exp, op0); return op0; because DECL_RTL will be set after expanding first function referencing tha= t. So, I guess one option is to remap DEBUG_EXPR_DECLs during inlining (and function versioning etc.), but guess that would need to be done very carefu= lly for the DW_OP_GNU_parameter_ref case of optimized away arguments, another o= ne would be to clear DECL_RTL of DEBUG_EXPR_DECLs at the end of expansion (say push DEBUG_EXPR_DECLs for which we SET_DECL_RTL into a vector and then walk= the vector and clear DECL_RTLs), or do this only for the vector type mode misma= tch case (ignore DECL_RTL in that case and therefore force a different DEBUG_EX= PR).=