From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 7FE3A388A004; Thu, 2 Apr 2020 10:22:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7FE3A388A004 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1585822969; bh=S6y3ZSWhfJ6KdsPiLBCWMHtyACRcOVR1QcftEEIC/AY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=KwqIwSH/fIZ5IKvPZKkJtA3VNAhOh1fpltTrqCMQ2pyvHRnXESnIjmn20TqzvUn+f KQQ5QNIBmA4tA7/6xA68Dw5uQOKNo/UQ8pspXSONtx2VqXuUXO1FklklbSCmSBz+rw kGuz0ICdlSejkTP2b0X6Cxczy/nt1B6Fxa7NKODU= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug debug/94450] lto abstract variable emitted as concrete decl Date: Thu, 02 Apr 2020 10:22:49 +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: 10.0 X-Bugzilla-Keywords: lto X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth 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: Thu, 02 Apr 2020 10:22:49 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D94450 --- Comment #3 from Richard Biener --- (In reply to Richard Biener from comment #2) > So the current situation is similar to that of Modifying the testcase to C99 inline int foo(int i) { static int j; j =3D i + 1; return j; } int bar(int i) { return foo(i); } int baz(int i) { return foo(i); } extern int foo(int i); [...] > Note we're not emitting a concrete instance of the function which would > contain the "main" instance of 'j'. Not sure what the DWARF for a > standalone concrete instantiation of 'j' would look like. The concrete instance is emitted: <1><57>: Abbrev Number: 6 (DW_TAG_subprogram) <58> DW_AT_abstract_origin: <0x2d> <5c> DW_AT_low_pc : 0x0 <64> DW_AT_high_pc : 0xa <6c> DW_AT_frame_base : 1 byte block: 9c (DW_OP_call_frame_c= fa) <6e> DW_AT_GNU_all_call_sites: 1 <6e> DW_AT_sibling : <0x89> <2><72>: Abbrev Number: 7 (DW_TAG_formal_parameter) <73> DW_AT_abstract_origin: <0x3d> <77> DW_AT_location : 1 byte block: 55 (DW_OP_reg5 (rdi)) <2><79>: Abbrev Number: 8 (DW_TAG_variable) <7a> DW_AT_abstract_origin: <0x46> <7e> DW_AT_location : 9 byte block: 3 0 0 0 0 0 0 0 0 (DW_OP_addr= : 0) so here's another copy of the variable. I guess for function local variables gdb isn't fooled to think it has two copies? And the bogus copy is not because of the abstract origin link but because of the unit import but could be brought in by other means of making gdb read the DWARF of it?=