@@ -11,6 +11,7 @@ lapack_int LAPACKE_dtrsyl3( int matrix_layout, char trana, char tranb,
1111 double * swork = NULL ;
1212 lapack_int ldswork = -1 ;
1313 lapack_int swork_size = -1 ;
14+ lapack_int iwork_query ;
1415 lapack_int * iwork = NULL ;
1516 lapack_int liwork = -1 ;
1617 if ( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
@@ -33,7 +34,7 @@ lapack_int LAPACKE_dtrsyl3( int matrix_layout, char trana, char tranb,
3334#endif
3435 /* Query optimal working array sizes */
3536 info = LAPACKE_dtrsyl3_work ( matrix_layout , trana , tranb , isgn , m , n , a , lda ,
36- b , ldb , c , ldc , scale , iwork , liwork ,
37+ b , ldb , c , ldc , scale , & iwork_query , liwork ,
3738 swork_query , ldswork );
3839 if ( info != 0 ) {
3940 goto exit_level_0 ;
@@ -45,8 +46,9 @@ lapack_int LAPACKE_dtrsyl3( int matrix_layout, char trana, char tranb,
4546 info = LAPACK_WORK_MEMORY_ERROR ;
4647 goto exit_level_0 ;
4748 }
49+ liwork = iwork_query ;
4850 iwork = (lapack_int * )LAPACKE_malloc ( sizeof (lapack_int ) * liwork );
49- if (iwork == NULL ) {
51+ if ( iwork == NULL ) {
5052 info = LAPACK_WORK_MEMORY_ERROR ;
5153 goto exit_level_1 ;
5254 }
0 commit comments