From: julie Date: Thu, 18 Mar 2010 19:31:57 +0000 (+0000) Subject: Fix bug0048-Hanging could occur in *gebal if a NaN is in input matrix sent by Alexand... X-Git-Tag: submit/tizen/20180313.231549~960 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=86e2baba6e03e6a204c86152a3e0d8f1246f2b99;p=platform%2Fupstream%2Flapack.git Fix bug0048-Hanging could occur in *gebal if a NaN is in input matrix sent by Alexander Kobotov(Intel) to lapack on Feb 3rd 2010 --- diff --git a/SRC/cgebal.f b/SRC/cgebal.f index 8708638b..c8c3e99a 100644 --- a/SRC/cgebal.f +++ b/SRC/cgebal.f @@ -118,10 +118,10 @@ COMPLEX CDUM * .. * .. External Functions .. - LOGICAL LSAME + LOGICAL SISNAN, LSAME INTEGER ICAMAX REAL SLAMCH - EXTERNAL LSAME, ICAMAX, SLAMCH + EXTERNAL SISNAN, LSAME, ICAMAX, SLAMCH * .. * .. External Subroutines .. EXTERNAL CSSCAL, CSWAP, XERBLA @@ -274,6 +274,14 @@ 160 CONTINUE IF( C.GE.G .OR. MAX( F, C, CA ).GE.SFMAX2 .OR. $ MIN( R, G, RA ).LE.SFMIN2 )GO TO 170 + IF( SISNAN( C+F+CA+R+G+RA ) ) THEN +* +* Exit if NaN to avoid infinite loop +* + INFO = -3 + CALL XERBLA( 'CGEBAL', -INFO ) + RETURN + END IF F = F*SCLFAC C = C*SCLFAC CA = CA*SCLFAC diff --git a/SRC/dgebal.f b/SRC/dgebal.f index 9056e778..56bc6e9e 100644 --- a/SRC/dgebal.f +++ b/SRC/dgebal.f @@ -116,10 +116,10 @@ $ SFMIN2 * .. * .. External Functions .. - LOGICAL LSAME + LOGICAL DISNAN, LSAME INTEGER IDAMAX DOUBLE PRECISION DLAMCH - EXTERNAL LSAME, IDAMAX, DLAMCH + EXTERNAL DISNAN, LSAME, IDAMAX, DLAMCH * .. * .. External Subroutines .. EXTERNAL DSCAL, DSWAP, XERBLA @@ -266,6 +266,14 @@ 160 CONTINUE IF( C.GE.G .OR. MAX( F, C, CA ).GE.SFMAX2 .OR. $ MIN( R, G, RA ).LE.SFMIN2 )GO TO 170 + IF( DISNAN( C+F+CA+R+G+RA ) ) THEN +* +* Exit if NaN to avoid infinite loop +* + INFO = -3 + CALL XERBLA( 'DGEBAL', -INFO ) + RETURN + END IF F = F*SCLFAC C = C*SCLFAC CA = CA*SCLFAC diff --git a/SRC/sgebal.f b/SRC/sgebal.f index d4df3c67..b780ae7b 100644 --- a/SRC/sgebal.f +++ b/SRC/sgebal.f @@ -116,10 +116,10 @@ $ SFMIN2 * .. * .. External Functions .. - LOGICAL LSAME + LOGICAL SISNAN, LSAME INTEGER ISAMAX REAL SLAMCH - EXTERNAL LSAME, ISAMAX, SLAMCH + EXTERNAL SISNAN, LSAME, ISAMAX, SLAMCH * .. * .. External Subroutines .. EXTERNAL SSCAL, SSWAP, XERBLA @@ -279,6 +279,14 @@ 180 CONTINUE IF( G.LT.R .OR. MAX( R, RA ).GE.SFMAX2 .OR. $ MIN( F, C, G, CA ).LE.SFMIN2 )GO TO 190 + IF( SISNAN( C+F+CA+R+G+RA ) ) THEN +* +* Exit if NaN to avoid infinite loop +* + INFO = -3 + CALL XERBLA( 'SGEBAL', -INFO ) + RETURN + END IF F = F / SCLFAC C = C / SCLFAC G = G / SCLFAC diff --git a/SRC/zgebal.f b/SRC/zgebal.f index 305bb550..7def8c79 100644 --- a/SRC/zgebal.f +++ b/SRC/zgebal.f @@ -118,10 +118,10 @@ COMPLEX*16 CDUM * .. * .. External Functions .. - LOGICAL LSAME + LOGICAL DISNAN, LSAME INTEGER IZAMAX DOUBLE PRECISION DLAMCH - EXTERNAL LSAME, IZAMAX, DLAMCH + EXTERNAL DISNAN, LSAME, IZAMAX, DLAMCH * .. * .. External Subroutines .. EXTERNAL XERBLA, ZDSCAL, ZSWAP @@ -274,6 +274,14 @@ 160 CONTINUE IF( C.GE.G .OR. MAX( F, C, CA ).GE.SFMAX2 .OR. $ MIN( R, G, RA ).LE.SFMIN2 )GO TO 170 + IF( DISNAN( C+F+CA+R+G+RA ) ) THEN +* +* Exit if NaN to avoid infinite loop +* + INFO = -3 + CALL XERBLA( 'ZGEBAL', -INFO ) + RETURN + END IF F = F*SCLFAC C = C*SCLFAC CA = CA*SCLFAC