From lisaev@umail.iu.edu Thu May 6 16:15:22 2010 Date: Thu, 6 May 2010 16:15:22 -0400 From: Leonid Isaev To: lapack@cs.utk.edu Subject: Possible bug in BLAS ?rotm.f (and possibly other) subroutines Message-ID: <20100506201522.GA25819@umail.iu.edu> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="VbJkn9YxBvnuCH5J" Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) Status: RO Content-Length: 4842 Lines: 127 --VbJkn9YxBvnuCH5J Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hello, While compiling and testing SVD routines in LAPack 3.2.1, I came across a fortran runtime error, which complained about BLAS' s(d)rotm.f files. I used: (i) gcc<4.5 FC = gfortran FFLAGS = -fbounds-check (ii) gcc=4.5 FC = gfortran FFLAGS = -fcheck=all The error message is: SVD: Testing Singular Value Decomposition routines ./xeigtsts < svd.in > ssvd.out At line 74 of file srotm.f Fortran runtime error: Index '2' of dimension 1 of array 'sx' above upper bound of 1 make: *** [ssvd.out] Error 2 and similar for drotm.f. Apparently, the program performs no bounds check for the sx(*) array. I think, the situation is similar to something like this: real::sx(1) ... if ((.false.).and.(sx(2)>0)) then ... end if So, "if" will never work, but the compiler is allowed to evaluate the condition in the parenthesis, thus sometimes resulting in a segfault, which would be pretty hard to catch especially in a big application. I haven't seen similar errors about other BLAS routines, but it does not mean there aren't any. Thank you, Leonid. PS: I also attach the output from gdb. --VbJkn9YxBvnuCH5J Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="gdb.out" GNU gdb (GDB) 7.1 Copyright (C) 2010 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "i686-pc-linux-gnu". For bug reporting instructions, please see: ... Reading symbols from /home/lisaev/web_buffer/lapack-3.2.1/TESTING/xeigtsts...(no debugging symbols found)...done. (gdb) r