On workspace query, routine returns minimal required size of 2*M*(N-M) for IJOB=4.
- Code: Select all
IF( IJOB.EQ.1 .OR. IJOB.EQ.2 .OR. IJOB.EQ.4 ) THEN
LWMIN = MAX( 1, 2*M*( N-M ) )
LIWMIN = MAX( 1, N+2 )
....
If we accept this and allocate WORK with this size, subsequent call crashes.
The reason is that zero-size working buffer is passed to ZTGSYL routine.
Please check the following lines (622-632) in ZTGSEN:
- Code: Select all
N1 = M
N2 = N - M
CALL ZTGSYL( 'N', IJB, N1, N2, A, LDA, A( I, I ), LDA, WORK,
$ N1, B, LDB, B( I, I ), LDB, WORK( N1*N2+1 ), N1,
$ DSCALE, DIF( 1 ), WORK( N1*N2*2+1 ),
$ [b]LWORK-2*N1*N2[/b], IWORK, IERR )
If LWORK=2*M*(N-M) as suggested on first call, then LWORK-2*N1*N2 = 0, which is not acceptable for ZTGSYL.
ZTGSYL crashes in line 388:
- Code: Select all
WORK( 1 ) = LWMIN
*
IF( LWORK.LT.LWMIN .AND. .NOT.LQUERY ) THEN
WORK(1) is being assigned before its size is checked.
In our case LWORK=0, and WORK(1) points beyond any allocated memory.
Please confirm the situation.
Regards,
Pavel Holoborodko.

