Skip to content
This repository has been archived by the owner on Jun 20, 2019. It is now read-only.

Commit

Permalink
Bug 122 - Fails to compile std.parallelism.reduce
Browse files Browse the repository at this point in the history
  • Loading branch information
ibuclaw committed Jun 14, 2014
1 parent 52d8237 commit a3c0cb1
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 3 deletions.
4 changes: 4 additions & 0 deletions gcc/d/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
2014-06-14 Iain Buclaw <ibuclaw@gdcproject.org>

* d-elem.cc(CondExp::toElem): Handle void type condition expressions.
(AssignExp::toElem): Use ismemset to test for initialising arrays with
a single value.
(StructLiteralExp::toElem): Build static initialiser if a symbol was
created by the front-end.
* d-codegen.h(d_types_compatible): First check equality of types, then
implicit compatibility.
* d-convert.cc(d_default_conversion): Remove function, fold
Expand Down
14 changes: 11 additions & 3 deletions gcc/d/d-elem.cc
Original file line number Diff line number Diff line change
Expand Up @@ -997,7 +997,7 @@ AssignExp::toElem (IRState *irs)
|| (e2->op == TOKcast && ((UnaExp *) e2)->e1->isLvalue())))
postblit = 1;

if (d_types_compatible (etype, tb2))
if (ismemset)
{
// Set a range of elements to one value.
tree t1 = maybe_make_temp (e1->toElem (irs));
Expand Down Expand Up @@ -2525,8 +2525,16 @@ StructLiteralExp::toElem (IRState *irs)

gcc_assert (tb->ty == Tstruct);

if (sinit && sinit->Stree)
return sinit->Stree;
if (sinit)
{
// Building sinit trees are delayed until after frontend semantic
// processing has complete. Build the static initialiser now.
if (sinit->Stree == NULL_TREE)
sd->toInitializer();

gcc_assert (sinit->Stree != NULL);
return sinit->Stree;
}

// CTFE may fill the hidden pointer by NullExp.
size_t dim = elements ? elements->dim : 0;
Expand Down
16 changes: 16 additions & 0 deletions gcc/testsuite/gdc.test/runnable/gdc.d
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,22 @@ immutable char C121 = void; // ICE

/******************************************/

// Bug 122

void test122()
{
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)));
}

/******************************************/

// Bug 127

int[0] test127a; // OK
Expand Down

0 comments on commit a3c0cb1

Please sign in to comment.