Index: tests/.expect/nested_function.txt
===================================================================
--- tests/.expect/nested_function.txt	(revision c3b9d639c9876ff82c7b2c0ec0381b02245b3660)
+++ tests/.expect/nested_function.txt	(revision 5416b449cf33c360fae6e2b852142eb1f9308ccc)
@@ -1,100 +1,1 @@
-j 3 3
-j 2 2
-j 2 2
-j 2 2
-j 1 1
-j 1 1
-j 1 1
-j 1 1
-j 1 1
-j 1 1
-j 1 1
-j 1 1
-j 1 1
-j 1 1
-j 1 1
-j 1 1
-j 0 0
-j 0 0
-j 0 0
-i 22 22
-j 3 3
-j 2 2
-j 2 2
-j 2 2
-j 1 1
-j 1 1
-j 1 1
-j 1 1
-j 1 1
-j 1 1
-j 1 1
-j 1 1
-j 1 1
-j 1 1
-j 1 1
-j 1 1
-j 0 0
-j 0 0
-j 0 0
-i 22 22
-j 3 3
-j 2 2
-j 2 2
-j 2 2
-j 1 1
-j 1 1
-j 1 1
-j 1 1
-j 1 1
-j 1 1
-j 1 1
-j 1 1
-j 1 1
-j 1 1
-j 1 1
-j 1 1
-j 0 0
-j 0 0
-j 0 0
-i 22 22
-j 3 3
-j 2 2
-j 2 2
-j 2 2
-j 1 1
-j 1 1
-j 1 1
-j 1 1
-j 1 1
-j 1 1
-j 1 1
-j 1 1
-j 1 1
-j 1 1
-j 1 1
-j 1 1
-j 0 0
-j 0 0
-j 0 0
-i 22 22
-j 3 3
-j 2 2
-j 2 2
-j 2 2
-j 1 1
-j 1 1
-j 1 1
-j 1 1
-j 1 1
-j 1 1
-j 1 1
-j 1 1
-j 1 1
-j 1 1
-j 1 1
-j 1 1
-j 0 0
-j 0 0
-j 0 0
-i 22 22
+total 105
Index: tests/nested_function.cfa
===================================================================
--- tests/nested_function.cfa	(revision c3b9d639c9876ff82c7b2c0ec0381b02245b3660)
+++ tests/nested_function.cfa	(revision 5416b449cf33c360fae6e2b852142eb1f9308ccc)
@@ -1,27 +1,13 @@
-//
-// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-//
-// nested_function.cfa -- Test nested functions run on user-thread stacks.
-//
-// Author           : Peter A. Buhr
-// Created On       : Mon May 23 22:21:30 2022
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Mon May 23 23:11:25 2022
-// Update Count     : 4
-// 
-
 #include <thread.hfa>
 #include <fstream.hfa>
 #include <stdlib.hfa>
 
-thread T {};
+enum { VALUES = 10_000 };
+int values[VALUES], total = 0;
 
-enum { VALUES = 10_000 };
-int values[VALUES];
+thread T { int id; };
 
 void main( T & ) {
+	int sum = 0;
 	void f() {
 		int i = 0;
@@ -36,14 +22,17 @@
 			else h();
 			i += 1;
-			sout | "j" | j | bsearchl( j, values, VALUES ); // has internal nested compare routine
+			sum += bsearchl( j, values, VALUES );		// has internal nested compare routine
 		} // h
 		h();
-		sout | "i" | i | bsearchl( i, values, VALUES ); // has internal nested compare routine
 	} // f
 	f();
+	__atomic_fetch_add( &total, sum, __ATOMIC_SEQ_CST );
 }
 int main() {
 	set_seed( 1003 );
 	for ( i; VALUES ) values[i] = i;
-	T t[5];
+	{
+		T t[5];
+	}
+	sout | "total" | total;
 }
