[Issue 12826] New: Win64: bad code for x ~= x;
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sat May 31 05:08:52 PDT 2014
https://issues.dlang.org/show_bug.cgi?id=12826
Issue ID: 12826
Summary: Win64: bad code for x ~= x;
Product: D
Version: D2
Hardware: x86_64
OS: Windows
Status: NEW
Keywords: wrong-code
Severity: major
Priority: P1
Component: DMD
Assignee: nobody at puremagic.com
Reporter: r.sagitario at gmx.de
This code:
void main()
{
string s, t;
t = t ~ "1234567";
s = s ~ "1234567";
s ~= s;
assert(s == "12345671234567", s);
assert(t == "1234567", t);
}
asserts when compiled for Win64 because "s ~= s;" overwrites t.
This happens because _d_arrayappendT(const TypeInfo ti, ref byte[] x, byte[] y)
is called with both parameters passed by ref according to the ABI, but no copy
is made for y.
--
More information about the Digitalmars-d-bugs
mailing list