[Issue 13237] New: Wrong code with "-inline -O"
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Fri Aug 1 07:29:21 PDT 2014
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: nobody at puremagic.com
Reporter: sinkuu at 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"
}
--
More information about the Digitalmars-d-bugs
mailing list