www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 5536] New: Array append with dollar op on 64-bit

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: dawg dawgfoto.de



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: -------
Feb 06 2011
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5536


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED



23:12:35 PST ---
https://github.com/D-Programming-Language/dmd/commit/f02795d86981f3b2560d4b1962dcea872daca484

https://github.com/D-Programming-Language/dmd/commit/835e7cfb6936bc796fa7857828dec5a07b2f604e

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 06 2011