@@ -1064,7 +1064,8 @@ void radix_i(int from, int to, int radix) {
10641064 push (my_gs , ngrp );
10651065 } else {
10661066 for (int i = 0 , f = from ; i < ngrp ; i ++ ) {
1067- pushState ((State ){f , f + my_gs [i ]- 1 , radix + 1 });
1067+ if (my_gs [i ] - 1 >= 0 )
1068+ pushState ((State ){f , f + my_gs [i ]- 1 , radix + 1 });
10681069 f += my_gs [i ];
10691070 }
10701071 }
@@ -1167,7 +1168,7 @@ void radix_i(int from, int to, int radix) {
11671168 } else {
11681169 // this single thread will now descend and resolve all groups, now that the groups are close in cache
11691170 for (int i = 0 , my_from = from ; i < ngrp ; i ++ ) {
1170- pushState ((State ){my_from , my_from + my_gs [i ]- 1 , radix + 1 });
1171+ if ( my_gs [ i ] - 1 >= 0 ) pushState ((State ){my_from , my_from + my_gs [i ]- 1 , radix + 1 });
11711172 my_from += my_gs [i ];
11721173 }
11731174 }
@@ -1379,6 +1380,7 @@ void radix_i(int from, int to, int radix) {
13791380 #pragma omp parallel for ordered schedule(dynamic) num_threads(MIN(nth, ngrp)) // #5077
13801381 for (int i = 0 ; i < ngrp ; i ++ ) {
13811382 int start = from + starts [ugrp [i ]];
1383+ #pragma omp critical(pushState)
13821384 pushState ((State ){start , start + my_gs [i ]- 1 , radix + 1 });
13831385 #pragma omp ordered
13841386 flush ();
@@ -1388,6 +1390,7 @@ void radix_i(int from, int to, int radix) {
13881390 #pragma omp parallel for schedule(dynamic) num_threads(MIN(nth, ngrp)) // #5077
13891391 for (int i = 0 ; i < ngrp ; i ++ ) {
13901392 int start = from + starts [ugrp [i ]];
1393+ #pragma omp critical(pushState)
13911394 pushState ((State ){start , start + my_gs [i ]- 1 , radix + 1 });
13921395 }
13931396 }
0 commit comments