From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 572853857017; Tue, 30 Jun 2020 11:45:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 572853857017 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1593517510; bh=NOJ14xZDC2yQy7i5EK21X9GbtVyBI+9t+htqutr2NAg=; h=From:To:Subject:Date:From; b=nzbCob0JxisHl1CN3ZZZ3fXbDtRGclOZZk+T7moQTom0QN9YknxEld84/ADsOK45I B6CAeotgJ8+cbdnTWNyOLlDe5zrkAtTSFCX9NQKKlWBjRHjUxyxRDFl/w+HrrDEp4q KWZm8XHq4Al5wwhid9+mcry8E7TaXiVa1EunJOoU= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug debug/96002] New: Wrong argument value shown by gdb at Og Date: Tue, 30 Jun 2020 11:45:10 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new 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: rguenth at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED 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: bug_id short_desc product version bug_status keywords bug_severity priority component assigned_to reporter target_milestone Message-ID: 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: Tue, 30 Jun 2020 11:45:10 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D96002 Bug ID: 96002 Summary: Wrong argument value shown by gdb at Og Product: gcc Version: 11.0 Status: UNCONFIRMED Keywords: wrong-debug Severity: normal Priority: P3 Component: debug Assignee: unassigned at gcc dot gnu.org Reporter: massarelli at diag dot uniroma1.it Target Milestone: --- Keywords: wrong-debug The second time line 5 is hit arguments p_21 is assigned a wrong value. $ cat -n a.c 1 int a, c; 2 int *b[3]; 3 void d(int e, short f, int g, char p_21) { 4 int h; 5 for (; c < 3; c++) 6 b[c] =3D &h; 7 } 8 int main() { d(a, 0, 1, 0); } $ cat a.c int a, c; int *b[3]; void d(int e, short f, int g, char p_21) { int h; for (; c < 3; c++) b[c] =3D &h; } int main() { d(a, 0, 1, 0); } $ gcc -v Using built-in specs. COLLECT_GCC=3Dgcc COLLECT_LTO_WRAPPER=3D/usr/local/bin/../libexec/gcc/x86_64-pc-linux-gnu/11.= 0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ./configure --prefix=3D/tmp/gcc_build --disable-multilib --enable-languages=3Dc,c++ Thread model: posix Supported LTO compression algorithms: zlib gcc version 11.0.0 20200624 (experimental) (GCC)=20 $ gcc -Og -g -o opt a.c $ gdb opt Reading symbols from opt... (gdb) b main Breakpoint 1 at 0x4004ad: file a.c, line 8. (gdb) r Starting program: opt=20 Breakpoint 1, main () at a.c:8 8 int main() { d(a, 0, 1, 0); } (gdb) s d (e=3D0, f=3Df@entry=3D0, g=3Dg@entry=3D1, p_21=3Dp_21@entry=3D0 '\000') a= t a.c:5 5 for (; c < 3; c++) (gdb) s 6 b[c] =3D &h; (gdb) bt #0 d (e=3D0, f=3Df@entry=3D0, g=3Dg@entry=3D1, p_21=3Dp_21@entry=3D0 '\000= ') at a.c:6 #1 0x00000000004004c7 in main () at a.c:8 (gdb) s 5 for (; c < 3; c++) (gdb) bt #0 d (e=3D0, f=3Df@entry=3D0, g=3Dg@entry=3D1, p_21=3D124 '|', p_21@entry= =3D0 '\000') at a.c:5 #1 0x00000000004004c7 in main () at a.c:8 (gdb)=