[Issue 14829] New: wrong code with -O -inline
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sun Jul 26 04:19:47 PDT 2015
https://issues.dlang.org/show_bug.cgi?id=14829
Issue ID: 14829
Summary: wrong code with -O -inline
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Keywords: wrong-code
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: ag0aep6g at gmail.com
Reduced from issue 14827.
----
int[] save(int[] a) {return a;}
bool isWhite(int c) {return c != 1;}
int decodeImpl(int[] str)
{
if (true) return 1;
}
int[] stripLeft(int[] str)
{
while (true)
{
int[] s = str.save;
int dc = decodeImpl(str);
str = str[1 .. $];
bool w = isWhite(dc);
assert(!w); /* passes */
if (!w) return s;
}
}
void main ()
{
assert ([2].stripLeft == [2]); /* fails with -O -inline */
}
----
--
More information about the Digitalmars-d-bugs
mailing list