[Issue 14131] va_copy is broken on posix X86_64

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat Feb 7 03:41:14 PST 2015


https://issues.dlang.org/show_bug.cgi?id=14131

--- Comment #3 from yebblies <yebblies at gmail.com> ---
The partial fix makes the original test case work, but this one should still
fail.

void copyb(ref va_list ap2, va_list ap)
{
    va_copy(ap2, ap);
}

void copya(int a, string format, ...)
{
    va_list ap;
    va_start(ap, format);

    va_list ap2;
    copyb(ap2, ap);

    auto a1 = va_arg!int(ap);
    auto a2 = va_arg!int(ap);
    auto a3 = va_arg!int(ap);

    assert(a1 == 0x11111111);
    assert(a2 == 0x22222222);
    assert(a3 == 0x33333333);

    auto b1 = va_arg!int(ap2);
    auto b2 = va_arg!int(ap2);
    auto b3 = va_arg!int(ap2);

    assert(b1 == 0x11111111);
    assert(b2 == 0x22222222);
    assert(b3 == 0x33333333);

    va_end(ap);
    va_end(ap2);
}

void testCopy()
{
    copya(0, "", 0x11111111, 0x22222222, 0x33333333);
}

--


More information about the Digitalmars-d-bugs mailing list