Thread overview
[Issue 663] New: Slice assignment does not bounds check when it should
Dec 07, 2006
d-bugmail
Dec 10, 2006
Thomas Kuehne
Dec 27, 2006
d-bugmail
December 07, 2006
http://d.puremagic.com/issues/show_bug.cgi?id=663

           Summary: Slice assignment does not bounds check when it should
           Product: D
           Version: 0.175
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: burton-radons@smocky.com


This code compiles and executes:

        auto test = new char [2];

        test [] = 'a';
        test = test [0 .. 1];
        test [0 .. 2] = 'b'; // this line should assert
        writef ("%s\n", test.ptr [0 .. 2]);

And produces the string "bb"; at the very least it should be "ba". DMD should throw an assertion failure at runtime on the marked line when -release mode is not specified.


-- 

December 10, 2006
d-bugmail@puremagic.com schrieb am 2006-12-07:
> http://d.puremagic.com/issues/show_bug.cgi?id=663

> This code compiles and executes:
>
>         auto test = new char [2];
>
>         test [] = 'a';
>         test = test [0 .. 1];
>         test [0 .. 2] = 'b'; // this line should assert
>         writef ("%s\n", test.ptr [0 .. 2]);
>
> And produces the string "bb"; at the very least it should be "ba". DMD should throw an assertion failure at runtime on the marked line when -release mode is not specified.

Added to DStress as http://dstress.kuehne.cn/norun/o/opSliceAssign_04_A.d

Thomas


December 27, 2006
http://d.puremagic.com/issues/show_bug.cgi?id=663


bugzilla@digitalmars.com changed:

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




------- Comment #2 from bugzilla@digitalmars.com  2006-12-27 02:01 -------
Fixed DMD 0.178


--