[Issue 5536] New: Array append with dollar op on 64-bit
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Feb 6 18:23:09 PST 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5536
Summary: Array append with dollar op on 64-bit
Product: D
Version: unspecified
Platform: x86_64
OS/Version: FreeBSD
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: dawg at dawgfoto.de
--- Comment #0 from dawg at dawgfoto.de 2011-02-06 18:20:48 PST ---
import std.stdio;
void main() {
int[] as = [111, 666];
writeln(as);
as ~= as[$ - 2]; //!<- doesn't append 111 but the one right to it
writeln(as);
//! subtracting one more works correctly
int[] bs = [111, 666];
writeln(bs);
bs ~= bs[$ - 3];
writeln(bs);
//! fetches memory outside of array
int[] cs = [111];
auto mem = *(&cs[0] + 1);
writeln(cs);
cs ~= cs[$ - 1];
writeln(cs);
assert(cs[1] == mem);
}
-----
!!! 64-bit specific error !!!
Assign appending using the dollar op fetches the wrong value.
Behaves as if the array length is updated before evaluating the dollar op.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list