You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For ijob == 0, only that one entry is needed; for ijob != 0, iwork will get allocated. Though I would also change the two if (ijob != 0) conditions to if (liwork > 1) for safety & clarity.
Description
In LAPACKE_*tgsen, if
ijob = 0
, noiwork
is allocated:https://github.com/Reference-LAPACK/lapack/blob/master/LAPACKE/src/lapacke_dtgsen.c#L86-L92
However, liwork = 1 and iwork( 1 ) is written to:
https://github.com/Reference-LAPACK/lapack/blob/master/SRC/dtgsen.f#L571-L575
One simple solution is to set
For ijob == 0, only that one entry is needed; for ijob != 0, iwork will get allocated. Though I would also change the two
if (ijob != 0)
conditions toif (liwork > 1)
for safety & clarity.Alternatively, delete the two
if (ijob != 0)
conditions:https://github.com/Reference-LAPACK/lapack/blob/master/LAPACKE/src/lapacke_dtgsen.c#L86
https://github.com/Reference-LAPACK/lapack/blob/master/LAPACKE/src/lapacke_dtgsen.c#L106
and always malloc iwork, even when liwork = 1.
This was discovered in writing the LAPACK++ wrapper (tgsen not yet pushed). The routine works for ijob = 1, 2, 3, 4, 5 but segfaults for ijob = 0:
Checklist
The text was updated successfully, but these errors were encountered: