www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10644] New: Win64: wrong code when passing arguments through ...

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10644

           Summary: Win64: wrong code when passing arguments through ...
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: wrong-code
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: r.sagitario gmx.de


--- Comment #0 from Rainer Schuetze <r.sagitario gmx.de> 2013-07-15 00:25:39
PDT ---
An example from the unittest of std.outbuffer:

import std.outbuffer;

void main()
{
    OutBuffer buf = new OutBuffer();

    buf.printf("%d", 42);
    assert(buf.toString() == "42");
}

build and run for win64 throws the assertion.

Checking the implementation of OutBuffer.printf shows that there is no uniform
abstraction for passing arguments to printf(string format, ...) anyway, and the
Win64 version seems broken.

This also applies to stream.printf.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 15 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10644


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla digitalmars.com


--- Comment #1 from Walter Bright <bugzilla digitalmars.com> 2013-07-19
00:51:07 PDT ---
This shrinks down to:
---------------------
import std.c.stdio;
import std.c.stdarg;

void vpr(string format, va_list args)
{
    char[128] buffer;
    int count;

    auto f = format.ptr;
    auto p = buffer.ptr;
    auto psize = buffer.length;
    printf("format = %d, %s\n", cast(int)format.length, f);
    count = _vsnprintf(p,psize,f,args);
    printf("count = %d, p = %s\n", count, p);
}

void pr(string format, ...)
{
    va_list ap;
    ap = cast(va_list)&format;
    ap += format.sizeof;
    vpr(format, ap);
}


void main()
{
    pr("%d", 42);
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 19 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10644


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|DMD                         |Phobos
           Platform|All                         |x86_64
         OS/Version|All                         |Windows


--- Comment #2 from Walter Bright <bugzilla digitalmars.com> 2013-07-19
14:19:44 PDT ---
https://github.com/D-Programming-Language/phobos/pull/1423

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 19 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10644



--- Comment #3 from github-bugzilla puremagic.com 2013-07-19 23:22:59 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/e16b2c81e55b0d1622c40cf3970a3f458dd2c2b8
fix Issue 10644 - Win64: wrong code when passing arguments through ...

https://github.com/D-Programming-Language/phobos/commit/1bd22b2e8b1a9bf5fb7c71d2490015d601925c28
Merge pull request #1423 from WalterBright/fix10644

fix Issue 10644 - Win64: wrong code when passing arguments through ...

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 19 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10644


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


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