--- timing/lin/linsrc/zgelss.f	Thu Dec  5 19:45:19 2002
+++ debian/updates/timing/lin/linsrc/zgelss.f	Wed Dec  4 15:23:42 2002
@@ -4,7 +4,7 @@
 *  -- LAPACK driver routine (instrumented to count ops, version 3.0) --
 *     Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
 *     Courant Institute, Argonne National Lab, and Rice University
-*     October 31, 1999
+*     April 25, 2001 
 *
 *     .. Scalar Arguments ..
       INTEGER            INFO, LDA, LDB, LWORK, M, N, NRHS, RANK
@@ -98,10 +98,9 @@
 *          LWORK >=  2*min(M,N) + max(M,N,NRHS)
 *          For good performance, LWORK should generally be larger.
 *
-*          If LWORK = -1, then a workspace query is assumed; the routine
-*          only calculates the optimal size of the WORK array, returns
-*          this value as the first entry of the WORK array, and no error
-*          message related to LWORK is issued by XERBLA.
+*          If LWORK = -1, a workspace query is assumed.  The optimal
+*          size for the WORK array is calculated and stored in WORK(1),
+*          and no other work except argument checking is performed.
 *
 *  RWORK   (workspace) DOUBLE PRECISION array, dimension (5*min(M,N))
 *
@@ -186,7 +185,7 @@
 *       immediately following subroutine, as returned by ILAENV.)
 *
       MINWRK = 1
-      IF( INFO.EQ.0 .AND. ( LWORK.GE.1 .OR. LQUERY ) ) THEN
+      IF( INFO.EQ.0 ) THEN
          MAXWRK = 0
          MM = M
          IF( M.GE.N .AND. M.GE.MNTHR ) THEN
@@ -254,13 +253,12 @@
                MAXWRK = MAX( MAXWRK, N*NRHS )
             END IF
          END IF
-         MINWRK = MAX( MINWRK, 1 )
          MAXWRK = MAX( MINWRK, MAXWRK )
          WORK( 1 ) = MAXWRK
+         IF( LWORK.LT.MINWRK .AND. .NOT.LQUERY )
+     $      INFO = -12
       END IF
 *
-      IF( LWORK.LT.MINWRK .AND. .NOT.LQUERY )
-     $   INFO = -12
       IF( INFO.NE.0 ) THEN
          CALL XERBLA( 'ZGELSS', -INFO )
          RETURN
@@ -631,10 +629,10 @@
      $                         DOPBL3( 'ZGEMM ', M, BL, M )
                T1 = DSECND( )
                CALL ZGEMM( 'C', 'N', M, BL, M, CONE, WORK( IL ), LDWORK,
-     $                     B( 1, I ), LDB, CZERO, WORK( IWORK ), N )
+     $                     B( 1, I ), LDB, CZERO, WORK( IWORK ), M )
                T2 = DSECND( )
                TIMNG( GEMM ) = TIMNG( GEMM ) + ( T2-T1 )
-               CALL ZLACPY( 'G', M, BL, WORK( IWORK ), N, B( 1, I ),
+               CALL ZLACPY( 'G', M, BL, WORK( IWORK ), M, B( 1, I ),
      $                      LDB )
    40       CONTINUE
          ELSE
