Reference-LAPACK / lapack

LAPACK development repository
Other
1.46k stars 430 forks source link

Uninitialized variables in BLAS test #1026

Closed ACSimon33 closed 1 month ago

ACSimon33 commented 1 month ago

Description

There are the following functions in the ?blat1.f files:

      DOUBLE PRECISION FUNCTION DXVALS(XX,K)
*     .. Scalar Arguments ..
      DOUBLE PRECISION  XX
      INTEGER           K
*     .. Local Scalars ..
      DOUBLE PRECISION  X, Y, YY, Z
*     .. Intrinsic Functions ..
      INTRINSIC         HUGE
*     .. Executable Statements ..
      Y = HUGE(XX)
      Z = YY
      IF (K.EQ.1) THEN
         X = -Z
      ELSE IF (K.EQ.2) THEN
         X = Z
      ELSE IF (K.EQ.3) THEN
         X = Z / Z
      END IF
      DXVALS = X
      RETURN
      END

As far as I can tell, YY is not defined, and Y is not used anywhere. I'm not sure if I'm missing something here but my guess is that it should be YY = HUGE(XX) and Y should be removed.

Checklist

ACSimon33 commented 1 month ago

@angsch

angsch commented 1 month ago

A fix is https://github.com/Reference-LAPACK/lapack/pull/964. However, a deeper investigation by @cdluminate revealed more problems with debian-specific build flags. Back then I tried to reproduce the problem, but without success. After that, I did not have time to look into this any further. It feels wrong, but if Inf/NaN tests are so troublesome, then perhaps the only solution is to not have any in reference LAPACK.

ACSimon33 commented 1 month ago

Oh, I somehow missed the other issue and PR. Thanks for pointing me to them.

ACSimon33 commented 1 month ago

Closing this because #964 was merged.