Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
Issue 13998 - Wrong code with -O -inline, loops, and taking address of double
  • Loading branch information
WalterBright committed Jan 31, 2015
1 parent 256feda commit 97b5326
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/backend/cod1.c
Original file line number Diff line number Diff line change
Expand Up @@ -1438,6 +1438,11 @@ code *getlvalue(code *pcs,elem *e,regm_t keepmsk)
}
else if (e->EV.sp.Voffset)
s->Sflags &= ~GTregcand;

if (config.fpxmmregs && tyfloating(s->ty()) && !tyfloating(ty))
// Can't successfully mix XMM register variables accessed as integers
s->Sflags &= ~GTregcand;

if (!(keepmsk & RMstore)) // if not store only
s->Sflags |= SFLread; // assume we are doing a read
break;
Expand Down
17 changes: 17 additions & 0 deletions test/runnable/testxmm.d
Original file line number Diff line number Diff line change
Expand Up @@ -1260,6 +1260,22 @@ void test12776()

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

void foo13988(double[] arr)
{
static ulong repr(double d) { return *cast(ulong*)&d; }
foreach (x; arr)
assert(repr(arr[0]) == *cast(ulong*)&(arr[0]));
}


void test13988()
{
double[] arr = [3.0];
foo13988(arr);
}

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

int main()
{
test1();
Expand Down Expand Up @@ -1290,6 +1306,7 @@ int main()
test12852();
test9449();
test9449_2();
test13988();

return 0;
}
Expand Down

0 comments on commit 97b5326

Please sign in to comment.