Skip to content

Commit

Permalink
fix Issue 18936 - Internal error: dmd/backend/cgxmm.c 684
Browse files Browse the repository at this point in the history
  • Loading branch information
WalterBright committed Jun 5, 2018
1 parent 3565605 commit d2884aa
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/dmd/backend/gsroa.c
Expand Up @@ -63,6 +63,8 @@ static void sliceStructs_Gather(SymInfo *sia, elem *e)
{
if (!sia[si].accessSlice)
{
/* [1] default as pointer type
*/
sia[si].ty0 = TYnptr;
sia[si].ty1 = TYnptr;
}
Expand Down Expand Up @@ -152,6 +154,27 @@ static void sliceStructs_Replace(SymInfo *sia, elem *e)
e->Eoper = OPpair;
e->E1 = e1;
e->E2 = e2;

if (tycomplex(e->Ety))
{
/* Ensure complex OPpair operands are floating point types
* because [1] may have defaulted them to a pointer type.
* https://issues.dlang.org/show_bug.cgi?id=18936
*/
tym_t tyop;
switch (tybasic(e->Ety))
{
case TYcfloat: tyop = TYfloat; break;
case TYcdouble: tyop = TYdouble; break;
case TYcldouble: tyop = TYldouble; break;
default:
assert(0);
}
if (!tyfloating(e1->Ety))
e1->Ety = tyop;
if (!tyfloating(e2->Ety))
e2->Ety = tyop;
}
}
else if (e->Eoffset == 0) // the first slice of the symbol is the same as the original
{
Expand Down
2 changes: 2 additions & 0 deletions test/compilable/cgxmm684.d → test/compilable/test18936.d
@@ -1,5 +1,7 @@
// REQUIRED_ARGS: -fPIC -O -release -inline -m64 -betterC
// DISABLED: win32 win64

// https://issues.dlang.org/show_bug.cgi?id=18936
// produces assert failure cgxmm.c line 684

import core.stdc.math;
Expand Down

0 comments on commit d2884aa

Please sign in to comment.