This is the mail archive of the gdb-prs@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

gdb/1863: Does not handle C99 dynamic arrays properly


>Number:         1863
>Category:       gdb
>Synopsis:       Does not handle C99 dynamic arrays properly
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Tue Feb 08 09:18:01 UTC 2005
>Closed-Date:
>Last-Modified:
>Originator:     jengelh@linux01.gwdg.de
>Release:        6.2.1
>Organization:
>Environment:
SUSE Linux 9.2
gcc version 3.3.4 (pre 3.3.5 20040809)
GNU gdb 6.2.1
binutils-2.15.91.0.2
>Description:
After having compiled the attached file, breaking at callme:

GDB 6.2.1 says:
> p &ar
(int (*)[2][2]) 0xabcdefgh

The [2][2] is wrong, should be [8][8] or at least [y][x]

> p sizeof(ar)
16

when in fact it is 256 (in this case of 8x8).
The program however, runs fine, as is proven by printing the sizeof in printf().
>How-To-Repeat:
Compile and debug :)
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="gdb_bug.c"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="gdb_bug.c"

I2luY2x1ZGUgPHN0ZGlvLmg+CgovKgpHREIgNi4yLjEgc2F5czoKPiBwICZhcgooaW50ICgqKVsy
XVsyXSkgMHhhYmNkZWZnaApUaGUgWzJdWzJdIGlzIHdyb25nLCBzaG91bGQgYmUgWzhdWzhdIG9y
IGF0IGxlYXN0IFt5XVt4XQoKPiBwIHNpemVvZihhcikKMTYKCndoZW4gaW4gZmFjdCBpdCBpcyAy
NTYgKGluIHRoaXMgY2FzZSBvZiA4eDgpLgoqLwoKc3RhdGljIHZvaWQgY2FsbG1lKGludCB4LCBp
bnQgeSkgewogICAgaW50IGFyW3ldW3hdOwogICAgcHJpbnRmKCJhcj0lcCwgc2l6ZW9mKGFyKT0l
ZFxuIiwgYXIsIHNpemVvZihhcikpOwogICAgcmV0dXJuOwp9CgppbnQgbWFpbih2b2lkKSB7CiAg
ICBjYWxsbWUoOCwgOCk7CiAgICByZXR1cm4gMDsKfQo=


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]