On 5 January 2015 at 08:28, Daniel Murphy via Digitalmars-d <digitalmars-d@puremagic.com> wrote: > "David Nadlinger" wrote in message > news:qlzdmlnzlklofmlkq...@forum.dlang.org... > >> It is. It breaks vararg cross-platform compatibility (e.g. Linux x86 vs. >> Linux x86_64) and GDC/LDC will never need it. It's something that we really >> to be fixed sooner than later. The only reason why the current situation is >> bearable is that C varargs are rarely ever used in D-only code. > > > Do you know how to fix it in dmd? I don't know why it's there in the first > place.
It is there because you still use a synthetic pointer for C varargs on x86_64. This synthetic pointer needs to be initialised to point to a static array otherwise bad things happen when you pass on to C. Enter __va_argsave to the rescue. void foo(int bar, ...) { va_list* va = void; va_list[1] __va_argsave; va = &__va_argsave; ... } The above being compiler generated by DMD.