From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id E3E913857830; Thu, 31 Mar 2022 16:55:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E3E913857830 From: "assaiante at diag dot uniroma1.it" 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 16:55:01 +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: assaiante at diag dot uniroma1.it 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, 31 Mar 2022 16:55:02 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D105108 --- Comment #8 from Cristian Assaiante = --- (In reply to Jakub Jelinek from comment #3) > And I certainly can't reproduce the wrong-debug issue you're talking abou= t. > If I change it to char l_144 =3D 8; > then optimized dump has: > [local count: 1073741824]: > # DEBUG BEGIN_STMT > # DEBUG l_144 =3D> 8 > # DEBUG BEGIN_STMT > # DEBUG l_165 =3D> 128 > # DEBUG BEGIN_STMT > # DEBUG l_144 =3D> NULL > # DEBUG BEGIN_STMT > a =3D 1; > return 0; > and in the debugger it correctly says that > (gdb) p l_144 > $1 =3D > because at the a =3D 1 store the value is unknown. I have tested again the C example with l_144 =3D 8 and in gdb l_144 is not = marked as optimized out, instead it has 8 as value: $ cat a.c int a; char b() { return 0; } int main() { char l_144 =3D 8; short l_165 =3D 128; l_144 =3D b(); a =3D l_144 !=3D l_165; } $ gcc -Og -g a.c -o opt DWARF info for l_144: 0x0000006b: DW_TAG_variable DW_AT_name ("l_144") DW_AT_decl_file ("/home/stepping/a.c") DW_AT_decl_line (4) DW_AT_decl_column (0x07) DW_AT_type (0x0000008d "char") DW_AT_location (0x0000000e:=20 [0x000000000040048c, 0x000000000040048c): DW_OP_lit8, DW_OP_stack_value) DW_AT_GNU_locviews (0x0000000c) GDB trace: Reading symbols from opt... (gdb) b 6 Breakpoint 1 at 0x40048c: file a.c, line 6. (gdb) r Starting program: /home/stepping/opt=20 Breakpoint 1, main () at a.c:7 7 a =3D l_144 !=3D l_165; (gdb) p l_144 $1 =3D 8 '\b' I will add the executable file as an attachment.=