Skip to content

Commit

Permalink
fix Issue 7806 - ICE(gloop.c) iterating with idouble, when compiling …
Browse files Browse the repository at this point in the history
…with -O
  • Loading branch information
WalterBright committed Oct 4, 2013
1 parent f0de143 commit ad9a300
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/backend/gloop.c
Expand Up @@ -2231,6 +2231,10 @@ STATIC void findbasivs(loop *l)
if (tyaggregate(s->ty()))
continue;

// Do not use complex types as basic IVs, as the code gen isn't up to it
if (tycomplex(s->ty()))
continue;

biv = Iv::mycalloc();
biv->IVnext = l->Livlist;
l->Livlist = biv; // link into list of IVs
Expand Down Expand Up @@ -2450,6 +2454,9 @@ STATIC void ivfamelems(register Iv *biv,register elem **pn)
else /* else leaf elem */
return; /* which can't be in the family */

if (tycomplex(n->Ety))
return;

if (op == OPmul || op == OPadd || op == OPmin ||
op == OPneg || op == OPshl)
{ /* Note that we are wimping out and not considering */
Expand Down
14 changes: 14 additions & 0 deletions test/runnable/complex.d
Expand Up @@ -2,6 +2,7 @@

import std.stdio;
import std.math;
import core.stdc.stdio;

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

Expand Down Expand Up @@ -342,6 +343,18 @@ void test10677()

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

void test7806()
{
for (idouble i = -2i; i <= 2i; i += .125i)
for (double r = -2; r <= 2; r += .0625)
{
cdouble c = r + i;
printf("%g %gi\n", c.re, c.im);
}
}

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

int main(char[][] args)
{

Expand All @@ -365,6 +378,7 @@ int main(char[][] args)
test7591();
test8966();
test10677();
test7806();

printf("Success!\n");
return 0;
Expand Down

0 comments on commit ad9a300

Please sign in to comment.