From eab8335e3320bed4294a4ee9c28118b116ebc2e6 Mon Sep 17 00:00:00 2001 From: netrunnereve <139727413+netrunnereve@users.noreply.github.com> Date: Sun, 30 Jul 2023 23:12:25 -0400 Subject: [PATCH] use memcpy in test-double-float.c --- tests/test-double-float.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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--);