Bug 6983 – Vararg corrupts string on 64bit

Status
RESOLVED
Resolution
WONTFIX
Severity
blocker
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2011-11-21T08:45:00Z
Last change time
2015-06-09T05:14:40Z
Keywords
wrong-code
Assigned to
nobody
Creator
bus_dbugzilla
Blocks
6047, 6576

Comments

Comment #0 by bus_dbugzilla — 2011-11-21T08:45:25Z
Works on 32-bit, fails on 64-bit linux: import core.vararg; void foo(...) { string str = *(cast(string*)_argptr); assert(str.length == 0); } void main() { foo(""); } This might be the same as issue 6758, but I'm not certain. This may be the root cause of issue 6047 and issue 6576.
Comment #1 by bugzilla — 2012-04-28T02:11:11Z
The 64 bit ABI won't allow using _argptr directly. Instead, use the functions in core.stdc.stdarg.
Comment #2 by clugdbug — 2012-04-29T00:12:05Z
(In reply to comment #1) > The 64 bit ABI won't allow using _argptr directly. Instead, use the functions > in core.stdc.stdarg. The real bug is bug 7893: the spec says you *can* use _argptr in this way.