www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21425] New: Using va_start twice results in wrong values


          Issue ID: 21425
           Summary: Using va_start twice results in wrong values
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: tim.dlang t-online.de

The following code fails with dmd v2.094.1 under Linux x86_64:

import core.vararg;

extern(C) void f(int dummy, ...)
        va_list ap;

        va_start(ap, dummy);
        int x = va_arg!int(ap);
        assert(x == 5);

        va_start(ap, dummy);
        int y = va_arg!int(ap);
        assert(y == 5);

int main()
        f(0, 5);
        return 0;

Issue 14131 could be related.

Nov 24 2020