Bug 14754 – [REG2.068b1] 64bit wrong code with -inline
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Windows
Creation time
2015-07-01T03:51:00Z
Last change time
2017-07-22T12:35:52Z
Keywords
pull, wrong-code
Assigned to
nobody
Creator
jiki
Comments
Comment #0 by jiki — 2015-07-01T03:51:18Z
This program crashed when compiled and run with -m64 -inline.
In 2.067, it works.
-----------------------
import std.algorithm;
import std.array;
auto aafunc(string k)
{
enum aa = [ "K": "V" ];
auto p = k in aa;
return null;
}
auto mapfun(R)(R words, string k)
{
return words.map!(s=>aafunc(k)).array;
}
void main()
{
auto r = [""].mapfun("");
}
Reduced test case:
auto aafunc(string k)
{
enum aa = [ "K": "V" ];
auto p = k in aa;
return null;
}
struct MapResult(alias fun, R)
{
R _input;
@property auto ref front()
{
return fun(_input[0]);
}
}
auto array(R)(R r)
{
alias E = typeof(r.front);
E[] result;
result ~= r.front;
return result;
}
auto mapfun(R)(R words, string k)
{
return array(MapResult!(s => aafunc(k), R)(words));
}
void main()
{
auto r = mapfun([""], "");
}