From 3727672a74c18938230c3a2db012a5693688bfd6 Mon Sep 17 00:00:00 2001 From: Martin Kroeker Date: Thu, 13 Apr 2023 18:07:52 +0200 Subject: [PATCH] Improve workaround and keep compilers from optimizing it out --- kernel/arm64/dznrm2_thunderx2t99.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/kernel/arm64/dznrm2_thunderx2t99.c b/kernel/arm64/dznrm2_thunderx2t99.c index e342b0b63..0bd274b3f 100644 --- a/kernel/arm64/dznrm2_thunderx2t99.c +++ b/kernel/arm64/dznrm2_thunderx2t99.c @@ -27,7 +27,7 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "common.h" - +#include #include #if defined(SMP) @@ -344,6 +344,7 @@ FLOAT CNAME(BLASLONG n, FLOAT *x, BLASLONG inc_x) FLOAT dummy_alpha[2]; #endif FLOAT ssq, scale; + volatile FLOAT sca; if (n <= 0 || inc_x <= 0) return 0.0; @@ -404,7 +405,8 @@ FLOAT CNAME(BLASLONG n, FLOAT *x, BLASLONG inc_x) #else nrm2_compute(n, x, inc_x, &ssq, &scale); #endif - if (fabs(scale) <1.e-300) return 0.; + sca = fabs(scale); + if (sca < DBL_MIN) return 0.; ssq = sqrt(ssq) * scale; return ssq;