[Issue 19042] Chunking a padRight'ed range leads to range violations

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Feb 17 06:53:41 UTC 2019


https://issues.dlang.org/show_bug.cgi?id=19042

Jon Degenhardt <jrdemail2000-dlang at yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jrdemail2000-dlang at yahoo.co
                   |                            |m

--- Comment #1 from Jon Degenhardt <jrdemail2000-dlang at yahoo.com> ---
This bug is triggered when a slice is taken entirely from the pad section at
the end of the range. Here's another variation:

---- issue_19042.d ----
import std.range;
import std.stdio;

void main(string[] args)
{
    auto r = [1, 2, 3, 4].padRight(0, 10);
    writeln("r[7 .. 9] : ", r[7 .. 9]);
}

---- Run -------

$ dmd issue_19042.d

$ ./issue_19042
core.exception.RangeError at INSTALLDIR/dmd2-2.084.0/osx/bin/../../src/phobos/std/range/package.d(12868):
Range violation
----------------
??:? _d_arrayboundsp [0x73c2b71]
??:? pure nothrow @nogc @safe std.range.padRight!(int[], int).padRight(int[],
int, ulong).Result std.range.padRight!(int[], int).padRight(int[], int,
ulong).Result.opSlice(ulong, ulong) [0x73aab65]
??:? _Dmain [0x73aa596]

--


More information about the Digitalmars-d-bugs mailing list