Issue 1323: dseupd routine may lead to a seg. fault, according to the type of argument

Reported by Edouard Canot, Oct 12, 2013

At the end of the dseupd routine, before the call to 'dger' (BLAS 
routine), 'rvec' should be tested.

Indeed, in the case where the user want to compute only the 
eigenvalues (and not the eigenvectors), he should set 'rvec = 
.false.'; besides he must set 'ldz = 1', as required in the 
   - in the best case 'dger' will give the following error:
     ** On entry to DGER parameter number  9 had an illegal value

   - in the worse case, a seg. fault will occur if the array 'z' is 
not allocated.

The documentation at the beginning of 'dseupd' says clearly that if 
'rvec' is false, then the array 'z' is not referenced. Note some 
inconsistency about the definition of 'ldz': it is supposed to be 
greater or equal to 1 (because 'dger' requires that), but this does 
not prevent the user to input an unallocated array (nowadays, 
programmers uses modern Fortran and they are encouraged to use 
allocatable arrays).

Consequently, as the 'z' array must not be referenced in the 
routine, 'rvec' must be added in the above-mentionned test.

Comment 1 by Edouard Canot, Oct 23, 2013

Here are two source files which illustrates the bug, as explained in 
the previous comment.

Comment 2 by Edouard Canot, Oct 24, 2013

Last, find a patch to fix dseupd.f

It has been created by using the command:
  $ diff -u dseupd.f dseupd_new.f > dseupd.f.patch
so that the following command should be sufficient to make the 
  $ cd SRC
  $ patch < dseupd.f.patch

Comment 3 by Sylvestre Ledru, Nov 6, 2013

Fixed by commit ca8f3fc66cd411abccfeb1a02af7544ad816e1af

Add test added 8446648c954d11e473b9d825ed9197e1603bf439

Status: Fixed

Created: 6 years 11 months ago by Edouard Canot

Updated: 6 years 10 months ago

Status: Fixed

Followed by: 1 person