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: nob...@puremagic.com
        ReportedBy: d...@dawgfoto.de


--- Comment #0 from d...@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: -------

Reply via email to