Bug 17092 – [REG 2.069.0] cannot get frame pointer from TaskPool.reduce

Status
RESOLVED
Resolution
DUPLICATE
Severity
regression
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2017-01-15T17:43:04Z
Last change time
2019-12-12T16:28:24Z
Assigned to
No Owner
Creator
Iain Buclaw

Comments

Comment #0 by ibuclaw — 2017-01-15T17:43:04Z
From gdc's own testsuite, this stopped being compilable from 2.069 and onwards. --- void main() { import std.algorithm : map; import std.parallelism : taskPool; import std.range : iota; immutable n = 10000; immutable delta = 1.0 / n; immutable pi = 4.0 * delta * taskPool.reduce!"a + b"( map!((int i) { immutable x = (i - 0.5) * delta; return 1.0 / (1.0 + x * x); })(iota(n))); } --- Introduced by: https://github.com/dlang/phobos/pull/3522 Emplacing `RTask.init` instead of `RTask()` fixes the compiler error, however, as per comment in PR: task[] = RTask.init; has two bugs: 1. RTask is a nested struct, so RTask.init contains null context pointer. 2. That is a block assignment, so there is a possibility to call RTask.~this() on garbage objects (stack allocated buf is initialized by void). I'm not totally convinced that (1) is a problem however.
Comment #1 by ibuclaw — 2017-01-15T17:47:29Z
(Edited title to match DMD's error message) /usr/include/dmd/phobos/std/parallelism.d(2632): Error: function std.parallelism.TaskPool.reduce!"a + b".reduce!(MapResult!(delegate (int i) => 1.00000 / (1.00000 + x * x), Result)).reduce cannot get frame pointer to D main
Comment #2 by bugzilla — 2019-12-12T16:28:24Z
Shorter example: void main() { import std.algorithm : map; import std.parallelism : taskPool; taskPool.reduce!"a + b"(map!(a=>1)([1,2,3])); } *** This issue has been marked as a duplicate of issue 16705 ***