Skip to content

Commit 1d4010e

Browse files
fix lastv possible range in slarf1f and slarf1l, #1011
1 parent 5889e3e commit 1d4010e

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

SRC/slarf1f.f

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,11 +157,11 @@ SUBROUTINE SLARF1F( SIDE, M, N, V, INCV, TAU, C, LDC, WORK )
157157
* .. Executable Statements ..
158158
*
159159
APPLYLEFT = LSAME( SIDE, 'L' )
160-
LASTV = 0
160+
LASTV = 1
161161
LASTC = 0
162162
IF( TAU.NE.ZERO ) THEN
163163
! Set up variables for scanning V. LASTV begins pointing to the end
164-
! of V.
164+
! of V up to V(1).
165165
IF( APPLYLEFT ) THEN
166166
LASTV = M
167167
ELSE
@@ -173,7 +173,7 @@ SUBROUTINE SLARF1F( SIDE, M, N, V, INCV, TAU, C, LDC, WORK )
173173
I = 1
174174
END IF
175175
! Look for the last non-zero row in V.
176-
DO WHILE( LASTV.GT.0 .AND. V( I ).EQ.ZERO )
176+
DO WHILE( LASTV.GT.1 .AND. V( I ).EQ.ZERO )
177177
LASTV = LASTV - 1
178178
I = I - INCV
179179
END DO
@@ -185,7 +185,7 @@ SUBROUTINE SLARF1F( SIDE, M, N, V, INCV, TAU, C, LDC, WORK )
185185
LASTC = ILASLR(M, LASTV, C, LDC)
186186
END IF
187187
END IF
188-
IF( LASTC.EQ.0 .OR. LASTV.EQ.0 ) THEN
188+
IF( LASTC.EQ.0 ) THEN
189189
RETURN
190190
END IF
191191
IF( APPLYLEFT ) THEN

SRC/slarf1l.f

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,11 +159,11 @@ SUBROUTINE SLARF1L( SIDE, M, N, V, INCV, TAU, C, LDC, WORK )
159159
* .. Executable Statements ..
160160
*
161161
APPLYLEFT = LSAME( SIDE, 'L' )
162-
LASTV = 0
162+
LASTV = 1
163163
LASTC = 0
164164
IF( TAU.NE.ZERO ) THEN
165165
! Set up variables for scanning V. LASTV begins pointing to the end
166-
! of V.
166+
! of V up to V(1).
167167
IF( APPLYLEFT ) THEN
168168
LASTV = M
169169
ELSE
@@ -175,7 +175,7 @@ SUBROUTINE SLARF1L( SIDE, M, N, V, INCV, TAU, C, LDC, WORK )
175175
I = 1
176176
END IF
177177
! Look for the last non-zero row in V.
178-
DO WHILE( LASTV.GT.0 .AND. V( I ).EQ.ZERO )
178+
DO WHILE( LASTV.GT.1 .AND. V( I ).EQ.ZERO )
179179
LASTV = LASTV - 1
180180
I = I - INCV
181181
END DO
@@ -187,7 +187,7 @@ SUBROUTINE SLARF1L( SIDE, M, N, V, INCV, TAU, C, LDC, WORK )
187187
LASTC = ILASLR(M, LASTV, C, LDC)
188188
END IF
189189
END IF
190-
IF( LASTC.EQ.0 .OR. LASTV.EQ.0 ) THEN
190+
IF( LASTC.EQ.0 ) THEN
191191
RETURN
192192
END IF
193193
IF( APPLYLEFT ) THEN

0 commit comments

Comments
 (0)