We recently found a stack corruption issue in (C,Z)GESVD that potentially could even lead to incorrect xerbla error message.
In ZGESVD array DUM which is used in LWORK query is a double precision array of size 1 allocated on stack:
DOUBLE PRECISION DUM( 1 )
DUM comes to ( ZGEQRF, ZUNGQR, ... ) as a WORK array to return an optimal LWORK value.
But in ( ZGEQRF, ZUNGQR, ... ) array WORK is declared as a COMPLEX*16 array. So WORK(1) = 1 corrupts the stack as it deals with complex value while pointer on input of the function is a pointer to double:
(oooooooo|xxxxxxxx), oooooooo fills with LWORK value, xxxxxxxx corrupts. Let compiler use xxxxxxxx to hold some value. After LWORK query the value will turn to be a zero.
"Hacky fix" would be to allocate DUM array of size 2.