Your message dated Sun, 03 Aug 2025 16:45:38 -0400
with message-id <[email protected]>
and subject line Re: Bug#630931: gdb: inspecting struct gives wrong pointer
has caused the Debian Bug report #630931,
regarding gdb: inspecting struct gives wrong pointer
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
630931: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=630931
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: gdb
Version: 7.2-1
Severity: normal

consider following program
typedef struct {
  int x;int y[];
} a;
a z;
a* y=&z;
int main(){
}

gdb writes wrong pointer when inspecting y.
(gdb) p y
$1 = (a *) 0x600848
(gdb) p *y
$2 = {x = 0, y = 0x600848}
(gdb) p y.y
$3 = 0x60084c

-- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.38-2-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF8, LC_CTYPE=en_US.UTF8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages gdb depends on:
ii  gdbserver               7.2-1            The GNU Debugger (remote server)
ii  libc6                   2.11.2-13        Embedded GNU C Library: Shared lib
ii  libexpat1               2.0.1-7          XML parsing C library - runtime li
ii  libncurses5             5.9-1            shared libraries for terminal hand
ii  libpython2.6            2.6.6-10         Shared Python runtime library (ver
ii  libreadline6            6.1-3            GNU readline and history libraries
ii  zlib1g                  1:1.2.3.4.dfsg-3 compression library - runtime

gdb recommends no packages.

Versions of packages gdb suggests:
pn  gdb-doc                       <none>     (no description available)

-- no debconf information



--- End Message ---
--- Begin Message ---
On Saturday, June 18 2011, Ondrej Bilka wrote:

> consider following program
> typedef struct {
>   int x;int y[];
> } a;
> a z;
> a* y=&z;
> int main(){
> }
>
> gdb writes wrong pointer when inspecting y.
> (gdb) p y
> $1 = (a *) 0x600848
> (gdb) p *y
> $2 = {x = 0, y = 0x600848}
> (gdb) p y.y
> $3 = 0x60084c

Thanks for the bug report.

I can't reproduce this with GDB 16.1:

--8<---------------cut here---------------start------------->8---
(gdb) p y
$1 = (a *) 0x55555555801c <z>
(gdb) p *y
$2 = {x = 0, y = 0x555555558020}
(gdb) p y.y
$3 = 0x555555558020
--8<---------------cut here---------------end--------------->8---

I'm closing the bug.  Feel free to reopen if it's still applicable.

-- 
Sergio
GPG key ID: 237A 54B1 0287 28BF 00EF  31F4 D0EB 7628 65FC 5E36
Please send encrypted e-mail if possible
https://sergiodj.net/

Attachment: signature.asc
Description: PGP signature


--- End Message ---

Reply via email to