From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 432C13858426; Fri, 3 Mar 2023 07:27:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 432C13858426 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1677828457; bh=K+keF8KZsc7ybvluNmJt1uIERk42BmXS9rcEvS/i86Q=; h=From:To:Subject:Date:In-Reply-To:References:From; b=n24W42K42VTDtWAMGJoY8IH+vFa0WN/o54wSfVagINCOD2+aVLY44Y/ylBDnHpBfU M0RWCAQ8k4v0J+xRn5eJl2XIAeC62Ez95hkJVm4UCcPizUrJ6xdjqOcWotbzjeXB3i QpnpONW2d14/x+0ir/sOUwqhao8vMRf5fptLlyqY= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug debug/108772] [13 Regression] ICE in force_decl_die, at dwarf2out.cc:26751 since r13-4161-g32d16fe9d7e347bc Date: Fri, 03 Mar 2023 07:27:36 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: debug X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: rguenth at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.0 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=3D108772 --- Comment #9 from CVS Commits --- The master branch has been updated by Richard Biener : https://gcc.gnu.org/g:33ca5c92dfa7e2f591a838bb768d9d6eea56793b commit r13-6438-g33ca5c92dfa7e2f591a838bb768d9d6eea56793b Author: Richard Biener Date: Wed Mar 1 10:01:10 2023 +0100 debug/108772 - ICE with late debug generated with -flto When combining -g1 with -flto we run into the DIE location annotation machinery for globals calling dwarf2out_late_global_decl but not having any early generated DIE for function scope statics. In this process we'd generate a limbo DIE since also the function scope doesn't have any early generated DIE. The limbo handling then tries to force a DIE for the context chain which ultimatively fails and ICEs at the std namespace decl because at -g1 we don't represent that. The following avoids this situation by making sure to never generate any DIEs from dwarf2out_late_global_decl in the in_lto_p path for function scope globals but rely on DIE generation for the function to output a DIE for the local static (which doesn't happen for -g1). I explored a lot of other options to fix this but in the end this seems to be the most spot-on fix with the least risk of unwanted effects. PR debug/108772 * dwarf2out.cc (dwarf2out_late_global_decl): Do not generate a DIE for a function scope static. * g++.dg/lto/pr108772_0.C: New testcase.=