Bug 10644 – Win64: wrong code when passing arguments through ...

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
x86_64
OS
Windows
Creation time
2013-07-15T00:25:00Z
Last change time
2013-07-20T11:42:19Z
Keywords
wrong-code
Assigned to
nobody
Creator
r.sagitario

Comments

Comment #0 by r.sagitario — 2013-07-15T00:25:39Z
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.
Comment #1 by bugzilla — 2013-07-19T00:51:07Z
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); }
Comment #2 by bugzilla — 2013-07-19T14:19:44Z
Comment #3 by github-bugzilla — 2013-07-19T23:22:59Z
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 ...