http://d.puremagic.com/issues/show_bug.cgi?id=3391

           Summary: gdb: dynamic arrays and associative arrays are not
                    properly printed
           Product: D
           Version: 1.048
          Platform: x86
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: llu...@gmail.com


--- Comment #0 from Leandro Lucarella <llu...@gmail.com> 2009-10-12 16:08:36 
PDT ---
DMD 1.049/2.034
---------------

$ cat -n bug.d
     1    version (Tango) alias char[] string;
     2    void main(string[] args)
     3    {
     4        float[2] f;
     5        f[0] = 1.45;
     6        f[1] = 3.45;
     7        int[] i;
     8        i ~= 5;
     9        i ~= 15;
    10        char[string] h;
    11        h["foo"] = 'f';
    12        h["bar"] = 'b';
    13        *(args.ptr + 1_000_000) = "boom";
    14    }
$ dmd -gc bug.d
$ gdb --quiet ./bug
Reading symbols from ./bug...done.
(gdb) run 1 2 3
Starting program: ./bug
[Thread debugging using libthread_db enabled]

Program received signal SIGSEGV, Segmentation fault.
0x08049bd2 in _Dmain (args=578452242739232769) at bug.d:13
13        *(args.ptr + 1_000_000) = "boom";
Current language:  auto
The current source language is "auto; currently d".
(gdb) print i
$1 = 13246370664958394370
(gdb) print f
$2 = {1.45000005, 3.45000005}
(gdb) print h
$3 = (void *) 0xb7d48fe0
(gdb) print args
$4 = 578452242739232769


LDC does a pretty good job with dynamic arrays (including char[] as strings):

Program received signal SIGSEGV, Segmentation fault.
0x08049718 in _Dmain (args=...) at ./bug.d:13
13        *(args.ptr + 1_000_000) = "boom";
(gdb) print i
$1 = {5, 15}
(gdb) print args
$2 = {"./bug", "1", "2", "3"}

Associative arrays seems to be not very well handled by any current compiler...

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to