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

          Issue ID: 13237
           Summary: Wrong code with "-inline -O"
           Product: D
           Version: D2
          Hardware: x86_64
                OS: All
            Status: NEW
          Severity: regression
          Priority: P1
         Component: DMD
          Assignee: nob...@puremagic.com
          Reporter: sin...@aol.jp

introduced by https://github.com/D-Programming-Language/dmd/pull/3819


size_t getLength(int[] arr) { return arr.length; }

void main()
{
    int[] arr = [0];
    immutable size_t len = getLength(arr);

    arr.length--;

    assert(len == 1); // ok
    if (len) { auto l = len; }
    assert(len == 1); // len cannot be changed, but produces Assertion failure
with "-O -inline"
}

--

Reply via email to