[Issue 21513] New: [Reg 2.094.1] Slice assignment segmentation fault

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Dec 29 09:04:05 UTC 2020


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

          Issue ID: 21513
           Summary: [Reg 2.094.1] Slice assignment segmentation fault
           Product: D
           Version: D2
          Hardware: x86_64
               URL: http://dlang.org/
                OS: Linux
            Status: NEW
          Severity: regression
          Priority: P3
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: thomas.bockman at gmail.com

This fails on recent dmd versions with -debug:
/////////////////////////////////////////////////////////////////////////
module app;

struct Stuff {
    size_t capacity;
    size_t[1] items;

    void grow() {
        const oldCapacity = capacity;
        items.ptr[0 .. oldCapacity] = items.ptr[0 .. oldCapacity];
        items.ptr[oldCapacity .. 1] = 0; // Segmentation fault (code -11)
    }
}

void main() {
    Stuff stuff;
    stuff.grow();
}

////////////////////////////////////////////////////////////////////////
run.dlang.io's "All dmd compilers (2.060 - latest)" mode claims the problem
started in 2.094.1:

Up to      2.093.1: Success and no output
Since      2.094.1: Failure with output: Error: program killed by signal 11

--


More information about the Digitalmars-d-bugs mailing list