From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C8FC3386F446; Sat, 14 Nov 2020 08:15:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C8FC3386F446 From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug debug/97599] [8/9/10/11 Regression] missing unspecified_parameters DIE in DWARF for functions with variable arguments Date: Sat, 14 Nov 2020 08:15:08 +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: 11.0 X-Bugzilla-Keywords: wrong-debug X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 8.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 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: Sat, 14 Nov 2020 08:15:08 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D97599 --- Comment #6 from CVS Commits --- The master branch has been updated by Jakub Jelinek : https://gcc.gnu.org/g:2873c8af66e1248734bb638a49e6bc53f5e45382 commit r11-5028-g2873c8af66e1248734bb638a49e6bc53f5e45382 Author: Jakub Jelinek Date: Sat Nov 14 09:14:19 2020 +0100 dwarf2: Emit DW_TAG_unspecified_parameters even in late DWARF [PR97599] Aldy's PR71855 fix avoided emitting multiple redundant DW_TAG_unspecified_parameters sub-DIEs of a single DIE by restricting it to early dwarf only. That unfortunately means if we need to emit another DIE for the function (whether it is for LTO, or e.g. because of IPA cloning), we don't emit DW_TAG_unspecified_parameters, it remains solely in the DW_AT_abstract_origin's referenced DIE. But DWARF consumers don't really use DW_TAG_unspecified_parameters from there, like we duplicate DW_TAG_formal_parameter sub-DIEs even in = the clones because either they have some more specific location, or e.g. a function clone could have fewer or different argument types etc., they need to assume that originally stdarg function isn't later stdarg = etc. Unfortunately, while for DW_TAG_formal_parameter sub-DIEs, we can use t= he hash tabs to look the PARM_DECLs if we already have the DIEs, for DW_TAG_unspecified_parameters we don't have an easy way to look it up. The following patch handles it by trying to figure out if we are creati= ng a fresh new DIE (in that case we add DW_TAG_unspecified_parameters if it = is stdarg), or if gen_subprogram_die is called again on an pre-existing DIE to fill in some further details (then it will not touch it). Except for lto, subr_die !=3D old_die would be good enough, but unfortu= nately for LTO the new DIE that will refer to early dwarf created DIE is creat= ed on the fly during lookup_decl_die. So the patch tracks if the DIE has no children before any children are added to it. 2020-11-14 Jakub Jelinek PR debug/97599 * dwarf2out.c (gen_subprogram_die): Call gen_unspecified_parameters_die even if not early dwarf, but only if subr_die is a newly created DIE.=