@@ -97,11 +97,13 @@ static float rand_float( void ) {
9797*/
9898static double benchmark1 ( int iterations , int len ) {
9999 stdlib_complex64_t alpha ;
100- float x [ len * 2 ];
101100 double elapsed ;
102101 double t ;
102+ float * x ;
103103 int i ;
104104
105+ x = (float * ) malloc ( len * 2 * sizeof ( float ) );
106+
105107 alpha = stdlib_complex64 ( 1.0f , 0.0f );
106108 for ( i = 0 ; i < len * 2 ; i += 2 ) {
107109 x [ i ] = ( rand_float ()* 2.0f ) - 1.0f ;
@@ -120,6 +122,7 @@ static double benchmark1( int iterations, int len ) {
120122 if ( x [ 0 ] != x [ 0 ] ) {
121123 printf ( "should not return NaN\n" );
122124 }
125+ free ( x );
123126 return elapsed ;
124127}
125128
@@ -132,11 +135,13 @@ static double benchmark1( int iterations, int len ) {
132135*/
133136static double benchmark2 ( int iterations , int len ) {
134137 stdlib_complex64_t alpha ;
135- float x [ len * 2 ];
136138 double elapsed ;
137139 double t ;
140+ float * x ;
138141 int i ;
139142
143+ x = (float * ) malloc ( len * 2 * sizeof ( float ) );
144+
140145 alpha = stdlib_complex64 ( 1.0f , 0.0f );
141146 for ( i = 0 ; i < len * 2 ; i += 2 ) {
142147 x [ i ] = ( rand_float ()* 2.0f ) - 1.0f ;
@@ -155,6 +160,7 @@ static double benchmark2( int iterations, int len ) {
155160 if ( x [ 0 ] != x [ 0 ] ) {
156161 printf ( "should not return NaN\n" );
157162 }
163+ free ( x );
158164 return elapsed ;
159165}
160166
0 commit comments