@@ -11,6 +11,7 @@ lapack_int LAPACKE_dtrsyl3( int matrix_layout, char trana, char tranb,
11
11
double * swork = NULL ;
12
12
lapack_int ldswork = -1 ;
13
13
lapack_int swork_size = -1 ;
14
+ lapack_int iwork_query ;
14
15
lapack_int * iwork = NULL ;
15
16
lapack_int liwork = -1 ;
16
17
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,
33
34
#endif
34
35
/* Query optimal working array sizes */
35
36
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 ,
37
38
swork_query , ldswork );
38
39
if ( info != 0 ) {
39
40
goto exit_level_0 ;
@@ -45,8 +46,9 @@ lapack_int LAPACKE_dtrsyl3( int matrix_layout, char trana, char tranb,
45
46
info = LAPACK_WORK_MEMORY_ERROR ;
46
47
goto exit_level_0 ;
47
48
}
49
+ liwork = iwork_query ;
48
50
iwork = (lapack_int * )LAPACKE_malloc ( sizeof (lapack_int ) * liwork );
49
- if (iwork == NULL ) {
51
+ if ( iwork == NULL ) {
50
52
info = LAPACK_WORK_MEMORY_ERROR ;
51
53
goto exit_level_1 ;
52
54
}
0 commit comments