From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 895BD3857C56; Fri, 21 Aug 2020 14:02:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 895BD3857C56 From: "vries at gcc dot gnu.org" To: gdb-prs@sourceware.org Subject: [Bug exp/26519] New: wrong type used when printing value Date: Fri, 21 Aug 2020 14:02:22 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: exp X-Bugzilla-Version: HEAD X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: vries at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status 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://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gdb-prs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-prs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Aug 2020 14:02:22 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D26519 Bug ID: 26519 Summary: wrong type used when printing value Product: gdb Version: HEAD Status: NEW Severity: normal Priority: P2 Component: exp Assignee: unassigned at sourceware dot org Reporter: vries at gcc dot gnu.org Target Milestone: --- Consider the following test-case: ... $ cat test.c struct ab { int a; int b; }; extern void bar (void *p); extern void foo (struct ab *); int main (void) { struct ab ab; struct { float a, b; } f =3D { 1.1, 2.1 }; bar (&f); foo (&ab); return 0; } $ cat test2.c struct ab; void foo (struct ab *p) { } $ cat test3.c struct ab; extern void bar2(struct ab *); void bar (struct ab *p) { bar2 (p); } $ cat test4.c struct ab { float a; float b; }; void bar2 (struct ab *p) { } ... Compiled like this: ... $ gcc -g test.c test2.c test3.c test4.c ... When we run to bar and print "*p" ... $ gdb -batch -iex "set language c" a.out -ex "b bar" -ex run -ex "p *p" Breakpoint 1 at 0x4004ef: file test3.c, line 8. Breakpoint 1, bar (p=3D0x7fffffffdc00) at test3.c:8 8 bar2 (p); $1 =3D {a =3D 1066192077, b =3D 1074161254} ... we use the type struct ab from test.c to print *p, which is incorrect. --=20 You are receiving this mail because: You are on the CC list for the bug.=