Array out-of-bounds in ila?lr.f in v3.3.1

Post here if you want to report a bug to the LAPACK team

Array out-of-bounds in ila?lr.f in v3.3.1

Postby lisaev » Sun Jun 26, 2011 2:32 pm

While building lapack 3.3.1, the testing stage fails with:
Code: Select all
[ntcgrid] lapack-3.3.1> make -j2 lapack_testing
...
make[1]: *** [stest.out] Error 2
make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory `/scratch/lisaev/lapack-3.3.1/TESTING'
make: *** [lapack_testing] Error 2
[ntcgrid] lapack-3.3.1>
[ntcgrid] lapack-3.3.1> cat ./TESTING/stest.out
At line 57 of file ilaslr.f
Fortran runtime error: Index '0' of dimension 1 of array 'a' below lower bound of 1
 Tests of the REAL LAPACK routines
 LAPACK VERSION 3.3.1
...

The make.inc is:
Code: Select all
[ntcgrid] lapack-3.3.1> cat make.inc | grep -v -e ^$ -e ^#
SHELL = /bin/bash
PLAT = _test
FORTRAN  = gfortran -fimplicit-none
OPTS     = -O3 -march=native -fimplicit-none -fcheck=all
DRVOPTS  = $(OPTS)
NOOPT    = -O0
LOADER   = gfortran
LOADOPTS =
TIMER    = INT_CPU_TIME
ARCH     = ar
ARCHFLAGS= cr
RANLIB   = ranlib
BLASLIB      = ../../blas$(PLAT).a
XBLASLIB     =
LAPACKLIB    = lapack$(PLAT).a
TMGLIB       = tmglib$(PLAT).a
EIGSRCLIB    = eigsrc$(PLAT).a
LINSRCLIB    = linsrc$(PLAT).a

The system is linux x86_64 and I am using a custom-built gfortran 4.5.3.

The problem happens because of this piece of code:
Code: Select all
[ntcgrid] lapack-3.3.1> sed -n '48,62p' ./SRC/ilaslr.f
      IF( M.EQ.0 ) THEN
         ILASLR = M
      ELSEIF( A(M, 1).NE.ZERO .OR. A(M, N).NE.ZERO ) THEN
         ILASLR = M
      ELSE
*     Scan up each column tracking the last zero row seen.
         ILASLR = 0
         DO J = 1, N
            I=M
            DO WHILE ((A(I,J).NE.ZERO).AND.(I.GE.1))
              I=I-1
            ENDDO
            ILASLR = MAX( ILASLR, I )
         END DO
      END IF

If the matrix has no non-zero rows and is defined as
Code: Select all
real::a(d,d)

then the element a(0,j) is references, which is out-of-bounds and triggers a runtime error.

I don't quite understand, what this [ilaslr.f] subroutine is supposed to do, because if I disable runtime checks and apply is to the matrix (real::a(1:3,1:3))
Code: Select all
1.0 1.0 1.0
1.0 1.0 1.0
0.0 0.0 0.0

It returns 3, while the correct answer is 2, no? I would say the 'fix' is the following loop:
Code: Select all
do j=1,n
     do i=m,1,-1
          if (a(i,j)/=zero) exit
     end do
     ilaslr=max(iladlr,i)
end do


Thank you.
lisaev
 
Posts: 3
Joined: Sun Jun 26, 2011 2:12 pm

Re: Array out-of-bounds in ila?lr.f in v3.3.1

Postby admin » Mon Jun 27, 2011 3:42 am

Indeed, this bug (label bug0079) has been corrected in the LAPACK repository but not yet released.
See the LAPACK 3.3.1 errata file http://www.netlib.org/lapack/Errata/index2.html
You can access the LAPACK SVN repository. See http://www.netlib.org/lapack/#_svn_access
Thank you for reporting the problem.
Julie
admin
Site Admin
 
Posts: 502
Joined: Wed Dec 08, 2004 7:07 pm

Re: Array out-of-bounds in ila?lr.f in v3.3.1

Postby lisaev » Mon Jun 27, 2011 5:18 pm

Cool, svn checkout works. Thanks for your work :)
Leonid.
lisaev
 
Posts: 3
Joined: Sun Jun 26, 2011 2:12 pm


Return to Bug report

Who is online

Users browsing this forum: Yahoo [Bot] and 2 guests

cron