The LAPACK forum has moved to https://github.com/Reference-LAPACK/lapack/discussions.

ZTGSEN reports work size smaller than required (and crashes)

Post here if you want to report a bug to the LAPACK team

ZTGSEN reports work size smaller than required (and crashes)

Postby int128 » Tue Dec 16, 2014 12:13 am

I would like to report a bug in ZTGSEN.

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.
int128
 
Posts: 14
Joined: Mon Nov 12, 2012 10:04 pm
Location: Yokohama, Japan

Return to Bug report

Who is online

Users browsing this forum: No registered users and 1 guest