[Issue 7735] New: Functions with variadic void[][]... arguments corrupts passed data

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Mar 19 14:53:25 PDT 2012


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

           Summary: Functions with variadic void[][]... arguments corrupts
                    passed data
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: pszturmaj at tlen.pl


--- Comment #0 from Piotr Szturmaj <pszturmaj at tlen.pl> 2012-03-19 14:53:41 PDT ---
This program:

import std.stdio;

void a(void[][] data...)
{
    writeln(data);
    b(data);
}

void b(void[][] data...)
{
    writeln(data);
    c(data);
}

void c(void[][] data...)
{
    writeln(data);
}

void main()
{
    a([]);
    a([]);
}

Prints:

[[]]
[[0, 0, 0, 0, 0, 0, 0, 0]]
[[8, 0, 0, 0, 88, 254, 19, 0]]
[[]]
[[0, 0, 0, 0, 0, 0, 0, 0]]
[[8, 0, 0, 0, 104, 254, 19, 0]]

Please note the difference between two a() calls. Also, data written from
within c() looks like array layout - 8 byte length and a pointer.

Tested with 2.059head and 32-bit Windows XP.

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


More information about the Digitalmars-d-bugs mailing list