@@ -106,8 +106,8 @@ static double complex identity( const double complex x ) {
106106* @return elapsed time in seconds
107107*/
108108static double benchmark ( int iterations , int len ) {
109- double complex x [ len ] ;
110- double complex y [ len ] ;
109+ double complex * x = malloc ( len * sizeof ( double complex ) ) ;
110+ double complex * y = malloc ( len * sizeof ( double complex ) ) ;
111111 double elapsed ;
112112 double t ;
113113 int i ;
@@ -120,8 +120,6 @@ static double benchmark( int iterations, int len ) {
120120 t = tic ();
121121 for ( i = 0 ; i < iterations ; i ++ ) {
122122 stdlib_strided_zmap ( len , x , 1 , y , 1 , identity );
123-
124- // Use a stable index for the check to avoid any "out of bounds" linter noise
125123 if ( y [ 0 ] != y [ 0 ] ) {
126124 printf ( "should not return NaN\n" );
127125 break ;
@@ -132,6 +130,8 @@ static double benchmark( int iterations, int len ) {
132130 if ( y [ 0 ] != y [ 0 ] ) {
133131 printf ( "should not return NaN\n" );
134132 }
133+ free ( x );
134+ free ( y );
135135 return elapsed ;
136136}
137137
@@ -152,8 +152,8 @@ int main( void ) {
152152 print_version ();
153153 count = 0 ;
154154 for ( i = MIN ; i <= MAX ; i ++ ) {
155- len = pow ( 10 , i );
156- iter = ITERATIONS / pow ( 10 , i - 1 );
155+ len = ( int ) pow ( 10 , i );
156+ iter = ITERATIONS / ( int ) pow ( 10 , i - 1 );
157157 for ( j = 0 ; j < REPEATS ; j ++ ) {
158158 count += 1 ;
159159 printf ( "# c::%s:len=%d\n" , NAME , len );
0 commit comments