From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D282E3858C50; Thu, 31 Mar 2022 06:39:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D282E3858C50 From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug debug/105108] incomplete/incorrect DWARF information at -O1 and -Og after inlining a function returning a constant Date: Thu, 31 Mar 2022 06:39:23 +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: 12.0 X-Bugzilla-Keywords: 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: everconfirmed bug_status cf_reconfirmed_on 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, 31 Mar 2022 06:39:23 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D105108 Richard Biener changed: What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Status|UNCONFIRMED |NEW Last reconfirmed| |2022-03-31 --- Comment #1 from Richard Biener --- Confirmed. At -O2 we end up with int main () { [local count: 1073741824]: [t.c:4:2] # DEBUG BEGIN_STMT [t.c:5:2] # DEBUG BEGIN_STMT [t.c:5:8] # DEBUG l_165 =3D> 128 [t.c:6:2] # DEBUG BEGIN_STMT [t.c:6:10] # DEBUG l_144 =3D> 0 [t.c:7:2] # DEBUG BEGIN_STMT [t.c:7:4] a =3D 1;=20 [:0:0] return 0; } while -O1 has int main () { [local count: 1073741824]: [t.c:4:2] # DEBUG BEGIN_STMT [t.c:5:2] # DEBUG BEGIN_STMT [t.c:5:8] # DEBUG l_165 =3D> 128 [t.c:6:2] # DEBUG BEGIN_STMT [t.c:7:2] # DEBUG BEGIN_STMT [t.c:7:4] a =3D 1;=20 [:0:0] return 0; with -O1 we do not inline b() but instead CCP uses value-range info to determine that l_144 cannot be 128 and thus the call to b() is DCEd before it is inlined. So indeed at -O1 we do not know the value of l_144, we only know that it cannot be 128. Not sure what we can do about the missing debug info - IIRC we cannot encode in DWARF that l_144 has the value of 'b()' (which is discovered to have no side-effects besides the return value).=