summaryrefslogtreecommitdiff
path: root/SRC/cgetc2.f
diff options
context:
space:
mode:
authorlangou <langou@users.noreply.github.com>2015-11-30 03:13:55 +0000
committerlangou <langou@users.noreply.github.com>2015-11-30 03:13:55 +0000
commit66636c801206b4790400ccbe6bbbeb5713894c67 (patch)
tree53eb921365234c1eb3fcea7231e2a9b88b624abe /SRC/cgetc2.f
parent9cbb6d773d43d30149cb50d4ac62ebe24f0092fb (diff)
downloadlapack-66636c801206b4790400ccbe6bbbeb5713894c67.tar.gz
lapack-66636c801206b4790400ccbe6bbbeb5713894c67.tar.bz2
lapack-66636c801206b4790400ccbe6bbbeb5713894c67.zip
address bug comment from Martin Köhler ( Max Planck Institute for Dynamics of Complex Technical Systems )
sent to lapack mailing list on Nov 29th at 7:26pm: "Bug in xGETC2" email of Martin Köhler below (1) add a quick return for N=0 (2) add a quick return for N=1 (3) no one reviewed this fix, feel free to comment Dear LAPACK people, I found a bug concerning the following function: The xGETC2 is the level-2 BLAS implementation of an LU decomposition with complete pivoting. Thereby, a "comparison depending on an uninitialized value" appears if the input is an one-by-one matrix. Namely the code in line 202 (LAPACK 3.5.0): IF( ABS( A( N, N ) ).LT.SMIN ) THEN accesses SMIN which is set in the previous DO loop. This loop is only called if N > 1 and so SMIN is not set to a well defined value if N = 1. But the documentation claims that all matrix N>=0 are allowed. Furthermore if calling with N = 0 the quick return statement is missing and the evaluation of ABS(A(N,N)) then yields an out-of-bound memory violation. These bug affect the real and the double precision code as well as their complex counterparts from LAPACK 3.0 up to the current LAPACK 3.6. regards, Martin Köhler
Diffstat (limited to 'SRC/cgetc2.f')
-rw-r--r--SRC/cgetc2.f20
1 files changed, 19 insertions, 1 deletions
diff --git a/SRC/cgetc2.f b/SRC/cgetc2.f
index fac6b568..99eb69d9 100644
--- a/SRC/cgetc2.f
+++ b/SRC/cgetc2.f
@@ -146,14 +146,32 @@
* ..
* .. Executable Statements ..
*
+ INFO = 0
+*
+* Quick return if possible
+*
+ IF( N.EQ.0 )
+ $ RETURN
+*
* Set constants to control overflow
*
- INFO = 0
EPS = SLAMCH( 'P' )
SMLNUM = SLAMCH( 'S' ) / EPS
BIGNUM = ONE / SMLNUM
CALL SLABAD( SMLNUM, BIGNUM )
*
+* Handle the case N=1 by itself
+*
+ IF( N.EQ.1 ) THEN
+ IPIV( 1 ) = 1
+ JPIV( 1 ) = 1
+ IF( ABS( A( 1, 1 ) ).LT.SMLNUM ) THEN
+ INFO = 1
+ A( 1, 1 ) = CMPLX( SMLNUM, ZERO )
+ END IF
+ RETURN
+ END IF
+*
* Factorize A using complete pivoting.
* Set pivots less than SMIN to SMIN
*