Thread overview
[Issue 765] New: ArrayBoundsError when assigning slice of pointer
Dec 29, 2006
d-bugmail
Dec 31, 2006
d-bugmail
Jan 04, 2007
d-bugmail
December 29, 2006
http://d.puremagic.com/issues/show_bug.cgi?id=765

           Summary: ArrayBoundsError when assigning slice of pointer
           Product: D
           Version: 0.178
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Keywords: wrong-code
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: fvbommel@wxs.nl


void main() {
    uint* where = (new uint[](5)).ptr;

    // either of these lines will throw an ArrayBoundsError
    // without even accessing an array variable :( (just a pointer)
    where[0 .. 5] = 1;
    where[0 .. 0] = 0;          // not even actually accessing anything!
}
-----
Error: ArrayBoundsError test.d(6)

This did not happen in DMD 0.173

The only reason I can think of for bounds checks to even be made on pointer
slices are:
* check (upper >= lower)
* check (upper * T.sizeof <= 2**32) (on 32-bit machine) to make sure stuff fits
into memory...

Both of these conditions are definitely satisfied here, so I don't see any legitimate reason for this to happen...


-- 

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





------- Comment #1 from thomas-dloop@kuehne.cn  2006-12-31 08:47 -------
Added to DStress as http://dstress.kuehne.cn/run/n/new_28_A.d http://dstress.kuehne.cn/run/n/new_28_B.d http://dstress.kuehne.cn/run/n/new_28_C.d http://dstress.kuehne.cn/run/n/new_28_D.d


-- 

January 04, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=765


bugzilla@digitalmars.com changed:

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




------- Comment #2 from bugzilla@digitalmars.com  2007-01-03 22:53 -------
Fixed DMD 1.00


--