Skip to content

Commit

Permalink
Fix repainting of compile-time reals for targets with 64-bit reals
Browse files Browse the repository at this point in the history
By converting the real_t to a `double` and repainting that value.
E.g., this fixes druntime-test-hash for MSVC targets;
core.internal.hash.hashOf!(real) reinterprets a 64-bit (target) `real`
as `ulong`, and that code path is taken at CTFE too.
  • Loading branch information
kinke committed Apr 26, 2019
1 parent 0ef41fc commit b4d7c09
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions dmd/compiler.d
Expand Up @@ -160,6 +160,9 @@ else
case Tfloat64:
u.float64value = cast(double) e.toReal();
break;
case Tfloat80:
assert(e.type.size() == 8); // 64-bit target `real`
goto case Tfloat64;
default:
assert(0, "Unsupported source type");
}
Expand Down Expand Up @@ -187,6 +190,10 @@ else
emplaceExp!(RealExp)(pue, e.loc, r, type);
break;

case Tfloat80:
assert(type.size() == 8); // 64-bit target `real`
goto case Tfloat64;

default:
assert(0, "Unsupported target type");
}
Expand Down

0 comments on commit b4d7c09

Please sign in to comment.