[Issue 23409] ImportC: multiple usages of va_list produces garbage

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Oct 12 22:07:31 UTC 2022


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

--- Comment #1 from dave287091 at gmail.com ---
The D version also seg faults, so maybe D’s implementation of stdarg is buggy?

import core.stdc.stdarg;
import core.stdc.stdio;

void printf10(const(char)* fmt, ...){
    for(int i = 0; i < 10; i++){
        va_list args;
        va_start(args, fmt);
        vprintf(fmt, args);
        va_end(args);
    }
}

int main(){
    printf10("Hello %s\n".ptr, "world".ptr);
    return 0;
}

--


More information about the Digitalmars-d-bugs mailing list