Bug 21425 – Using va_start twice results in wrong values

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2020-11-24T22:50:32Z
Last change time
2023-05-27T21:22:47Z
Keywords
pull, wrong-code
Assigned to
No Owner
Creator
Tim
See also
https://issues.dlang.org/show_bug.cgi?id=23409

Comments

Comment #0 by tim.dlang — 2020-11-24T22:50:32Z
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_end(ap); va_start(ap, dummy); int y = va_arg!int(ap); assert(y == 5); va_end(ap); } int main() { f(0, 5); return 0; } Issue 14131 could be related.
Comment #1 by bugzilla — 2023-05-24T01:54:45Z
Yes, it's the same issue as 23409. Thanks, Tim!
Comment #2 by bugzilla — 2023-05-24T01:56:08Z
*** Issue 23409 has been marked as a duplicate of this issue. ***
Comment #3 by dlang-bot — 2023-05-25T03:59:39Z
@WalterBright created dlang/dmd pull request #15267 "fix Issue 21425 - Using va_start twice results in wrong values" fixing this issue: - fix Issue 21425 - Using va_start twice results in wrong values https://github.com/dlang/dmd/pull/15267
Comment #4 by dlang-bot — 2023-05-27T21:22:47Z
dlang/dmd pull request #15267 "fix Issue 21425 - Using va_start twice results in wrong values" was merged into master: - 427e00b3ef47362f900c21d1db4a608d00b3dad9 by Walter Bright: fix Issue 21425 - Using va_start twice results in wrong values https://github.com/dlang/dmd/pull/15267