Thread overview
win64 vararg bug?
Feb 10, 2013
Benjamin Thaut
Feb 10, 2013
Benjamin Thaut
Feb 10, 2013
Nick Sabalausky
Feb 10, 2013
kinke
Feb 10, 2013
kinke
February 10, 2013
I have this small test program, it will crash when compiled on x64 windows, but it works fine on 32bit windows. What am I doing wrong?

import core.vararg;
import std.stdio;

void print(string fmt, ...)
{
  auto arg = va_arg!(const(char)[])(_argptr);
  writefln(fmt ~ arg);
}

void main(string[] args)
{
  print("+++","---");
}

Kind Regards
Benjamin Thaut
-- 
Kind Regards
Benjamin Thaut
February 10, 2013
Am 10.02.2013 09:18, schrieb Benjamin Thaut:
> import core.vararg;
> import std.stdio;
>
> void print(string fmt, ...)
> {
>    auto arg = va_arg!(const(char)[])(_argptr);
>    writefln(fmt ~ arg);
> }
>
> void main(string[] args)
> {
>    print("+++","---");
> }

This only seems to happen when the argument before the variadic argument list is bigger then 8 byte. This works:

void print(int fmt, ...)
{
  auto arg = va_arg!(const(char)[])(_argptr);
  writefln("%s %s",fmt,arg);
}

void main(string[] args)
{
  print(1,"---");
}

February 10, 2013
On Sun, 10 Feb 2013 09:18:58 +0100
Benjamin Thaut <code@benjamin-thaut.de> wrote:

> I have this small test program, it will crash when compiled on x64 windows, but it works fine on 32bit windows. What am I doing wrong?
> 
> import core.vararg;
> import std.stdio;
> 
> void print(string fmt, ...)
> {
>    auto arg = va_arg!(const(char)[])(_argptr);
>    writefln(fmt ~ arg);
> }
> 
> void main(string[] args)
> {
>    print("+++","---");
> }
> 
> Kind Regards
> Benjamin Thaut

Might be related to these:

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

February 10, 2013
On Sunday, 10 February 2013 at 08:18:50 UTC, Benjamin Thaut wrote:
> I have this small test program, it will crash when compiled on x64 windows, but it works fine on 32bit windows. What am I doing wrong?
>
> import core.vararg;
> import std.stdio;
>
> void print(string fmt, ...)
> {
>   auto arg = va_arg!(const(char)[])(_argptr);
>   writefln(fmt ~ arg);
> }
>
> void main(string[] args)
> {
>   print("+++","---");
> }
>
> Kind Regards
> Benjamin Thaut

This works for me when using https://github.com/ldc-developers/ldc/pull/287 and LLVM 3.2.
LDC currently uses the incompatible System V ABI for Win64...
February 10, 2013
Sorry about that, I thought I was browsing the LDC newsgroup. ;)