diff --git a/tests/test-double-float.c b/tests/test-double-float.c index cd7bbf666..fe04ef2d2 100644 --- a/tests/test-double-float.c +++ b/tests/test-double-float.c @@ -7,6 +7,7 @@ #include #include #include +#include #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wdouble-promotion" @@ -32,8 +33,8 @@ inline static float silu_float(float x) { int main(void) { uint32_t x = UINT32_MAX; do { - float *y = (float *)&x; - float f = *y; + float f; + memcpy(&f, &x, sizeof(x)); assert(!isfinite(f) || (round_orig(f) == round_float(f))); } while (x--);