Index: tests/.expect/PRNG.x64.txt
===================================================================
--- tests/.expect/PRNG.x64.txt	(revision a50fdfbfae933dc68ef63eb07fe97924c504fe1b)
+++ tests/.expect/PRNG.x64.txt	(revision 6e1e2d0299e4210d269f7a30ec3864a8bddceabb)
@@ -1,2 +1,4 @@
+
+CFA xoshiro256pp
 
                     PRNG()     PRNG(5)   PRNG(0,5)
@@ -56,11 +58,11 @@
 
 Sequential
-trials 100000000 buckets 100000 min 875 max 1146 avg 1000.0 std 31.6 rstd 3.2%
+trials 20000000 buckets 100000 min 139 max 265 avg 200.0 std 14.1 rstd 7.0%
 
 Concurrent
-trials 100000000 buckets 100000 min 875 max 1146 avg 1000.0 std 31.6 rstd 3.2%
-trials 100000000 buckets 100000 min 875 max 1146 avg 1000.0 std 31.6 rstd 3.2%
-trials 100000000 buckets 100000 min 875 max 1146 avg 1000.0 std 31.6 rstd 3.2%
-trials 100000000 buckets 100000 min 875 max 1146 avg 1000.0 std 31.6 rstd 3.2%
+trials 20000000 buckets 100000 min 139 max 265 avg 200.0 std 14.1 rstd 7.0%
+trials 20000000 buckets 100000 min 139 max 265 avg 200.0 std 14.1 rstd 7.0%
+trials 20000000 buckets 100000 min 139 max 265 avg 200.0 std 14.1 rstd 7.0%
+trials 20000000 buckets 100000 min 139 max 265 avg 200.0 std 14.1 rstd 7.0%
 
                    prng(t)   prng(t,5) prng(t,0,5)
Index: tests/.expect/PRNG.x86.txt
===================================================================
--- tests/.expect/PRNG.x86.txt	(revision a50fdfbfae933dc68ef63eb07fe97924c504fe1b)
+++ tests/.expect/PRNG.x86.txt	(revision 6e1e2d0299e4210d269f7a30ec3864a8bddceabb)
@@ -1,2 +1,4 @@
+
+CFA xoshiro128pp
 
                     PRNG()     PRNG(5)   PRNG(0,5)
@@ -56,11 +58,11 @@
 
 Sequential
-trials 100000000 buckets 100000 min 858 max 1147 avg 1000.0 std 31.5 rstd 3.2%
+trials 20000000 buckets 100000 min 144 max 270 avg 200.0 std 14.1 rstd 7.1%
 
 Concurrent
-trials 100000000 buckets 100000 min 858 max 1147 avg 1000.0 std 31.5 rstd 3.2%
-trials 100000000 buckets 100000 min 858 max 1147 avg 1000.0 std 31.5 rstd 3.2%
-trials 100000000 buckets 100000 min 858 max 1147 avg 1000.0 std 31.5 rstd 3.2%
-trials 100000000 buckets 100000 min 858 max 1147 avg 1000.0 std 31.5 rstd 3.2%
+trials 20000000 buckets 100000 min 144 max 270 avg 200.0 std 14.1 rstd 7.1%
+trials 20000000 buckets 100000 min 144 max 270 avg 200.0 std 14.1 rstd 7.1%
+trials 20000000 buckets 100000 min 144 max 270 avg 200.0 std 14.1 rstd 7.1%
+trials 20000000 buckets 100000 min 144 max 270 avg 200.0 std 14.1 rstd 7.1%
 
                    prng(t)   prng(t,5) prng(t,0,5)
Index: tests/Makefile.am
===================================================================
--- tests/Makefile.am	(revision a50fdfbfae933dc68ef63eb07fe97924c504fe1b)
+++ tests/Makefile.am	(revision 6e1e2d0299e4210d269f7a30ec3864a8bddceabb)
@@ -11,6 +11,6 @@
 ## Created On       : Sun May 31 09:08:15 2015
 ## Last Modified By : Peter A. Buhr
-## Last Modified On : Fri Feb  3 23:06:44 2023
-## Update Count     : 94
+## Last Modified On : Mon Apr 10 23:24:02 2023
+## Update Count     : 96
 ###############################################################################
 
@@ -184,5 +184,5 @@
 
 SYNTAX_ONLY_CODE = expression typedefRedef variableDeclarator switch numericConstants identFuncDeclarator \
-	init1 limits nested-types cast labelledExit array quasiKeyword include/stdincludes include/includes builtins/sync warnings/self-assignment
+	init1 limits nested-types cast labelledExit array quasiKeyword include/stdincludes include/includes builtins/sync warnings/self-assignment concurrent/waitfor/parse
 $(SYNTAX_ONLY_CODE): % : %.cfa $(CFACCBIN)
 	$(CFACOMPILE_SYNTAX)
Index: tests/PRNG.cfa
===================================================================
--- tests/PRNG.cfa	(revision a50fdfbfae933dc68ef63eb07fe97924c504fe1b)
+++ tests/PRNG.cfa	(revision 6e1e2d0299e4210d269f7a30ec3864a8bddceabb)
@@ -8,6 +8,6 @@
 // Created On       : Wed Dec 29 09:38:12 2021
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Wed Dec 21 20:39:59 2022
-// Update Count     : 406
+// Last Modified On : Sun Apr 23 22:02:09 2023
+// Update Count     : 420
 // 
 
@@ -15,16 +15,21 @@
 #include <stdlib.hfa>									// PRNG
 #include <clock.hfa>
-#include <thread.hfa>
 #include <limits.hfa>									// MAX
 #include <math.hfa>										// sqrt
 #include <malloc.h>										// malloc_stats
 #include <locale.h>										// setlocale
+#include <thread.hfa>
 #include <mutex_stmt.hfa>
 
-#ifdef __x86_64__										// 64-bit architecture
+#define xstr(s) str(s)
+#define str(s) #s
+
+#if defined( __x86_64__ ) || defined( __aarch64__ )		// 64-bit architecture
 #define PRNG PRNG64
 #else													// 32-bit architecture
 #define PRNG PRNG32
 #endif // __x86_64__
+
+//#define TIME
 
 #ifdef TIME												// use -O2 -nodebug
@@ -38,6 +43,6 @@
 #endif // TIME
 
-void avgstd( unsigned int buckets[] ) {
-	unsigned int min = MAX, max = 0;
+static void avgstd( size_t trials, size_t buckets[] ) {
+	size_t min = MAX, max = 0;
 	double sum = 0.0, diff;
 	for ( i; BUCKETS ) {
@@ -54,5 +59,5 @@
 	} // for
 	double std = sqrt( sum / BUCKETS );
-	mutex( sout ) sout | "trials"  | TRIALS | "buckets" | BUCKETS
+	mutex( sout ) sout | "trials"  | trials | "buckets" | BUCKETS
 		| "min" | min | "max" | max
 		| "avg" | wd(0,1, avg) | "std" | wd(0,1, std) | "rstd" | wd(0,1, (avg == 0 ? 0.0 : std / avg * 100)) | "%";
@@ -64,9 +69,9 @@
 thread T1 {};
 void main( T1 & ) {
-	unsigned int * buckets = calloc( BUCKETS );			// too big for task stack
-	for ( TRIALS / 100 ) {
+	size_t * buckets = calloc( BUCKETS );				// too big for task stack
+	for ( TRIALS / 50 ) {
 		buckets[rand() % BUCKETS] += 1;					// concurrent
 	} // for
-	avgstd( buckets );
+	avgstd( TRIALS / 50, buckets );
 	free( buckets );
 } // main
@@ -76,9 +81,9 @@
 	PRNG prng;
 	if ( seed != 0 ) set_seed( prng, seed );
-	unsigned int * buckets = calloc( BUCKETS );			// too big for task stack
+	size_t * buckets = calloc( BUCKETS );				// too big for task stack
 	for ( TRIALS ) {
 		buckets[prng( prng ) % BUCKETS] += 1;			// concurrent
 	} // for
-	avgstd( buckets );
+	avgstd( TRIALS, buckets );
 	free( buckets );
 } // main
@@ -86,9 +91,9 @@
 thread T3 {};
 void main( T3 & th ) {
-	unsigned int * buckets = calloc( BUCKETS );			// too big for task stack
-	for ( TRIALS ) {
+	size_t * buckets = calloc( BUCKETS );				// too big for task stack
+	for ( TRIALS / 5 ) {
 		buckets[prng() % BUCKETS] += 1;					// concurrent
 	} // for
-	avgstd( buckets );
+	avgstd( TRIALS / 5, buckets );
 	free( buckets );
 } // main
@@ -96,9 +101,9 @@
 thread T4 {};
 void main( T4 & th ) {
-	unsigned int * buckets = calloc( BUCKETS );			// too big for task stack
+	size_t * buckets = calloc( BUCKETS );				// too big for task stack
 	for ( TRIALS ) {
-		buckets[prng( th ) % BUCKETS] += 1;	// concurrent
-	} // for
-	avgstd( buckets );
+		buckets[prng( th ) % BUCKETS] += 1;				// concurrent
+	} // for
+	avgstd( TRIALS, buckets );
 	free( buckets );
 } // main
@@ -108,9 +113,9 @@
 static void dummy( thread$ & th ) __attribute__(( noinline ));
 static void dummy( thread$ & th ) {
-	unsigned int * buckets = (unsigned int *)calloc( BUCKETS, sizeof(unsigned int) ); // too big for task stack
-	for ( unsigned int i = 0; i < TRIALS; i += 1 ) {
+	size_t * buckets = (size_t *)calloc( BUCKETS, sizeof(size_t) ); // too big for task stack
+	for ( size_t i = 0; i < TRIALS; i += 1 ) {
 		buckets[prng( th ) % BUCKETS] += 1;				// sequential
 	} // for
-	avgstd( buckets );
+	avgstd( TRIALS, buckets );
 	free( buckets );
 } // dummy
@@ -118,6 +123,7 @@
 
 int main() {
-	// causes leaked storage message
-	// setlocale( LC_NUMERIC, getenv( "LANG" ) );			// print digit separator
+	// setlocale( LC_NUMERIC, getenv( "LANG" ) );		// causes leaked storage message
+
+	// only works on the current pthread thread
 	// locale_t loc = newlocale( LC_NUMERIC_MASK, getenv( "LANG" ), (locale_t)0p );
 	// if ( loc == (locale_t)0p ) abort( "newlocale" );
@@ -126,7 +132,10 @@
 	enum { TASKS = 4 };
 	Time start;
+
 #ifdef TIME												// too slow for test and generates non-repeatable results
 #if 1
-	unsigned int rseed;
+	sout | "glib rand" | nl | nl;
+
+	size_t rseed;
 	if ( seed != 0 ) rseed = seed;
 	else rseed = rdtscl();
@@ -134,5 +143,5 @@
 
 	sout | sepDisable;
-	sout | wd(26, "rand()" ) | wd(12, "rand(5)") | wd(12, "rand(0,5)" );
+	sout | nl | wd(26, "rand()" ) | wd(12, "rand(5)") | wd(12, "rand(0,5)" );
 	for ( 20 ) {
 		sout | wd(26, rand()) | nonl;
@@ -146,12 +155,12 @@
 	STARTTIME;
 	{
-		unsigned int * buckets = calloc( BUCKETS );		// too big for task stack
-		for ( i; TRIALS / 10 ) {
+		size_t * buckets = calloc( BUCKETS );			// too big for task stack
+		for ( i; TRIALS / 5 ) {
 			buckets[rand() % BUCKETS] += 1;				// sequential
 		} // for
-		avgstd( buckets );
+		avgstd( TRIALS / 5, buckets );
 		free( buckets );
 	}
-	ENDTIME( " x 10 " );
+	ENDTIME( " x 5 " );
 
 	sout | nl | "Concurrent";
@@ -163,7 +172,10 @@
 		} // wait for threads to complete
 	}
-	ENDTIME( " x 100 " );
+	ENDTIME( " x 50 " );
 #endif // 0
 #endif // TIME
+
+	sout | nl | "CFA " xstr(PRNG_NAME);
+
 #if 1
 	PRNG prng;
@@ -184,9 +196,9 @@
 	STARTTIME;
 	{
-		unsigned int * buckets = calloc( BUCKETS );		// too big for task stack
+		size_t * buckets = calloc( BUCKETS );			// too big for task stack
 		for ( TRIALS ) {
 			buckets[prng( prng ) % BUCKETS] += 1;		// sequential
 		} // for
-		avgstd( buckets );
+		avgstd( TRIALS, buckets );
 		free( buckets );
 	}
@@ -219,12 +231,12 @@
 	STARTTIME;
 	{
-		unsigned int * buckets = calloc( BUCKETS );		// too big for task stack
-		for ( TRIALS ) {
+		size_t * buckets = calloc( BUCKETS );			// too big for task stack
+		for ( TRIALS / 5 ) {
 			buckets[prng() % BUCKETS] += 1;
 		} // for
-		avgstd( buckets );
+		avgstd( TRIALS / 5, buckets );
 		free( buckets );
 	}
-	ENDTIME();
+	ENDTIME( " x 5 " );
 
 	sout | nl | "Concurrent";
@@ -236,5 +248,5 @@
 		} // wait for threads to complete
 	}
-	ENDTIME();
+	ENDTIME( " x 5 " );
 #endif // 0
 #if 1
Index: tests/concurrent/waitfor/parse.cfa
===================================================================
--- tests/concurrent/waitfor/parse.cfa	(revision a50fdfbfae933dc68ef63eb07fe97924c504fe1b)
+++ tests/concurrent/waitfor/parse.cfa	(revision 6e1e2d0299e4210d269f7a30ec3864a8bddceabb)
@@ -1,10 +1,16 @@
-//----------------------------------------------------------------------------------------
-//----------------------------------------------------------------------------------------
+// 
+// Cforall Version 1.0.0 Copyright (C) 2017 University of Waterloo
 //
-//		DEPRECATED TEST
-//		DIFFERS BETWEEN DEBUG AND RELEASE
-//
-//----------------------------------------------------------------------------------------
-//----------------------------------------------------------------------------------------
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+// 
+// waitfor.c -- 
+// 
+// Author           : Peter A. Buhr
+// Created On       : Wed Aug 30 17:53:29 2017
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Mon Apr 10 22:52:18 2023
+// Update Count     : 64
+// 
 
 #include <monitor.hfa>
@@ -12,91 +18,244 @@
 monitor M {};
 
-M a;
-
-void f1( M & mutex a );
-void f2( M & mutex a );
-void f2( M & mutex a, M & mutex b );
-void f3( M & mutex a );
-void f3( M & mutex a, M & mutex b );
-void f3( M & mutex a, M & mutex b, M & mutex c );
-
-void foo() {
-
-	//---------------------------------------
-	waitfor( f1 : a ) {
-		1;
-	}
-
-	//---------------------------------------
-	waitfor( f1 : a ) {
-		2;
-	}
-	waitfor( f2 : a ) {
-		3;
-	}
-
-	//---------------------------------------
-	when( 1 < 3 ) waitfor( f2 : a, a ) {
-		4;
-	}
-	or timeout( 100 ) {
-		5;
-	}
-
-	//---------------------------------------
-	when( 2 < 3 ) waitfor( f3 : a ) {
-		5;
-	}
+void notcalled( M & mutex m1, M & mutex m2 ) {
+	abort();
+}
+void or( M & mutex m ) {
+	abort();
+}
+void timeout( M & mutex m ) {
+	abort();
+}
+
+void fred( M & mutex m, M & mutex or, M & mutex timeout ) {
+	// test waitfor and when
+
+	waitfor( notcalled : m, m );
+
+	waitfor( notcalled : m, m ) {
+	}
+
+	waitfor( notcalled : m, m ) {
+	}
+
+	when( true ) waitfor( notcalled : m, m );
+
+	when( true ) waitfor( notcalled : m, m ) {
+	}
+
+	waitfor( notcalled : m, m );
+	or waitfor( notcalled : m, m );
+
+	when( true ) waitfor( notcalled : m, m );
+	or when( true ) waitfor( notcalled : m, m );
+
+	waitfor( notcalled : m, m ) {
+	} or waitfor( notcalled : m, m ) {
+	}
+
+	waitfor( notcalled : m, m ) {
+	} or waitfor( notcalled : m, m ) {
+	}
+
+	when( true ) waitfor( notcalled : m, m ) {
+	} or when( true ) waitfor( notcalled : m, m ) {
+	}
+
+	waitfor( notcalled : m, m );
+	or waitfor( notcalled : m, m ) {
+	}
+
+	when( true ) waitfor( notcalled : m, m );
+	or when( true ) waitfor( notcalled : m, m ) {
+	}
+
+	waitfor( notcalled : m, m ) {
+	} or waitfor( notcalled : m, m );
+
+	when( true ) waitfor( notcalled : m, m ) {
+	} or when( true ) waitfor( notcalled : m, m );
+
+	// test when, waitfor and else
+
+	waitfor( notcalled : m, m );
+	or else;
+
+	when( true ) waitfor( notcalled : m, m );
+	or else;
+
+	when( true ) waitfor( notcalled : m, m );
+	or else;
+
+	waitfor( notcalled : m, m ) {
+	} or else {
+	}
+
+	when( true ) waitfor( notcalled : m, m ) {
+	} or else {
+	}
+
+	waitfor( notcalled : m, m );
 	or else {
-		6;
-	}
-
-	//---------------------------------------
-	when( 3 < 3 ) waitfor( f3 : a, a ) {
-		7;
-	}
-	or when( 4 < 3 ) timeout( 101 ) {
-		8;
-	}
-	or when( 5 < 3 ) else {
-		9;
-	}
-
-	//---------------------------------------
-	when( 6 < 3 ) waitfor( f3 : a, a, a ) {
-		10;
-	}
- 	or when( 7 < 3 ) waitfor( f1 : a  ) {
-		11;
-	}
+	}
+
+	when( true ) waitfor( notcalled : m, m );
 	or else {
-		12;
-	}
-
-	//---------------------------------------
-	when( 8 < 3 ) waitfor( f3 : a, a ) {
-		13;
-	}
- 	or waitfor( f1 : a  ) {
-		14;
-	}
-	or when( 9 < 3 ) timeout( 102 ) {
-		15;
-	}
-
-	//---------------------------------------
-	when( 10 < 3 ) waitfor( f1 : a ) {
-		16;
-	}
- 	or waitfor( f2 : a, a ) {
-		17;
-	}
-	or timeout( 103 ) {
-		18;
-	}
-	or when( 11 < 3 ) else {
-		19;
-	}
-}
-
-int main() {}
+	}
+
+	when( true ) waitfor( notcalled : m, m );
+	or else {
+	}
+
+	waitfor( notcalled : m, m ) {
+	} or else;
+
+	when( true ) waitfor( notcalled : m, m ) {
+	} or else;
+
+	waitfor( notcalled : m, m );
+	or when( true ) else;
+
+	when( true ) waitfor( notcalled : m, m );
+	or when( true ) else;
+
+	when( true ) waitfor( notcalled : m, m );
+	or when( true ) else;
+
+	waitfor( notcalled : m, m ) {
+	} or when( true ) else {
+	}
+
+	when( true ) waitfor( notcalled : m, m ) {
+	} or when( true ) else {
+	}
+
+	waitfor( notcalled : m, m );
+	or when( true ) else {
+	}
+
+	when( true ) waitfor( notcalled : m, m );
+	or when( true ) else {
+	}
+
+	when( true ) waitfor( notcalled : m, m );
+	or when( true ) else {
+	}
+
+	waitfor( notcalled : m, m ) {
+	} or when( true ) else;
+
+	when( true ) waitfor( notcalled : m, m ) {
+	} or when( true ) else;
+
+	// test when, waitfor and timeout
+
+	waitfor( notcalled : m, m );
+	or timeout( 3 );
+
+	waitfor( notcalled : m, m );
+	or timeout( 3 );
+
+	when( true ) waitfor( notcalled : m, m );
+	or timeout( 3 );
+
+	waitfor( notcalled : m, m ) {
+	} or timeout( 3 ) {
+	}
+
+	when( true ) waitfor( notcalled : m, m ) {
+	} or timeout( 3 ) {
+	}
+
+	when( true ) waitfor( notcalled : m, m ) {
+	} or timeout( 3 ) {
+	}
+
+	when( true ) waitfor( notcalled : m, m ) {
+	} or when ( true ) timeout( 3 ) {
+	}
+
+	when( true ) waitfor( notcalled : m, m ) {
+	} or when ( true ) timeout( 3 ) {
+	}
+
+	waitfor( notcalled : m, m );
+	or timeout( 3 ) {
+	}
+
+	when( true ) waitfor( notcalled : m, m );
+	or timeout( 3 ) {
+	}
+
+	when( true ) waitfor( notcalled : m, m );
+	or when( true ) timeout( 3 ) {
+	}
+
+	waitfor( notcalled : m, m ) {
+	} or timeout( 3 );
+
+	when( true ) waitfor( notcalled : m, m ) {
+	} or timeout( 3 );
+
+	when( true ) waitfor( notcalled : m, m ) {
+	} or when( true ) timeout( 3 );
+
+	// test when, waitfor, timeout and else
+
+	waitfor( notcalled : m, m ) {
+	} or timeout( 3 ) {
+	} or when( true ) else {}
+
+	when( true ) waitfor( notcalled : m, m ) {
+	} or timeout( 3 ) {
+	} or when( true ) else {}
+
+	waitfor( notcalled : m, m ) {
+	} or timeout( 3 ) {
+	} or when( true ) else {}
+
+	waitfor( notcalled : m, m ) {
+	} or when( true ) timeout( 3 ) {
+	} or when( true ) else {}
+
+	when( true ) waitfor( notcalled : m, m ) {
+	} or timeout( 3 ) {
+	} or when( true ) else {}
+
+	waitfor( notcalled : m, m ) {
+	} or when( true ) timeout( 3 ) {
+	} or when( true ) else {}
+
+	when( true ) waitfor( notcalled : m, m ) {
+	} or when( true ) timeout( 3 ) {
+	} or when( true ) else {}
+
+	// test quasi-keywords "or" and "timeout"
+
+	int or = 0, timeout = 0;
+	waitfor( timeout : timeout ) timeout += 1; or timeout( timeout );
+	waitfor( notcalled : or, or ) or += 1; or timeout( or ) 3;
+	when( or ) waitfor( or : m ) { 4; } or timeout( or ) or += 1;
+	when( timeout ) waitfor( notcalled : timeout, timeout ) or += 1; or else timeout += 1;
+	when( or + timeout ) waitfor( or : m ) 4; or when( or ) timeout( or ) 4; or when( or ) else timeout += 1;
+	when( 3 ) waitfor( or : or ) 3; or when( or ) waitfor( notcalled : or, or ) 4; or else 4;
+	when( timeout ) waitfor( or : timeout ) 3; or waitfor( notcalled : timeout, or ) 4; or when( or ) timeout( timeout ) 4;
+	when( 3 ) waitfor( or : timeout ) or += 1;
+	or waitfor( or : or ) timeout += 1;
+	or timeout( timeout ) or += 1;
+	or when( 3 ) else or += 1;
+
+	// test else selection
+
+	if ( or > timeout ) waitfor( or : or ) 3;
+	else waitfor( timeout : timeout ) 4;
+}
+
+//Dummy main
+int main( int argc, char const * argv[] ) {
+    #pragma GCC warning "Compiled"                      // force non-empty .expect file, NO TABS!!!
+}
+
+// Local Variables: //
+// tab-width: 4 //
+// compile-command: "cfa waitfor.cfa" //
+// End: //
Index: tests/concurrent/waitfor/parse2.cfa
===================================================================
--- tests/concurrent/waitfor/parse2.cfa	(revision a50fdfbfae933dc68ef63eb07fe97924c504fe1b)
+++ 	(revision )
@@ -1,249 +1,0 @@
-// 
-// Cforall Version 1.0.0 Copyright (C) 2017 University of Waterloo
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-// 
-// waitfor.c -- 
-// 
-// Author           : Peter A. Buhr
-// Created On       : Wed Aug 30 17:53:29 2017
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Thu Jan 16 23:13:37 2020
-// Update Count     : 6
-// 
-
-#include <stdbool.h>
-
-int fred() {
-	int x, z;
-
-	// test waitfor and when
-
-	waitfor( x );
-
-	waitfor( x ) {
-	}
-
-	waitfor( x : z ) {
-	}
-
-	when( true ) waitfor( x );
-
-	when( true ) waitfor( x ) {
-	}
-
-	waitfor( x );
-	or waitfor( y );
-
-	waitfor( x : z );
-	or waitfor( y );
-
-	when( true ) waitfor( x );
-	or when( true ) waitfor( y );
-
-	when( true ) waitfor( x : z );
-	or when( true ) waitfor( y );
-
-	waitfor( x ) {
-	} or waitfor( y ) {
-	}
-
-	waitfor( x : z ) {
-	} or waitfor( y ) {
-	}
-
-	when( true ) waitfor( x ) {
-	} or when( true ) waitfor( y ) {
-	}
-
-	waitfor( x );
-	or waitfor( y ) {
-	}
-
-	when( true ) waitfor( x );
-	or when( true ) waitfor( y ) {
-	}
-
-	waitfor( x ) {
-	} or waitfor( y );
-
-	when( true ) waitfor( x ) {
-	} or when( true ) waitfor( y );
-
-	// test when, waitfor and else
-
-	waitfor( x );
-	or else;
-
-	when( true ) waitfor( x );
-	or else;
-
-	when( true ) waitfor( x : z );
-	or else;
-
-	waitfor( x ) {
-	} or else {
-	}
-
-	when( true ) waitfor( x ) {
-	} or else {
-	}
-
-	waitfor( x );
-	or else {
-	}
-
-	when( true ) waitfor( x );
-	or else {
-	}
-
-	when( true ) waitfor( x : z );
-	or else {
-	}
-
-	waitfor( x ) {
-	} or else;
-
-	when( true ) waitfor( x ) {
-	} or else;
-
-	waitfor( x );
-	or when( true ) else;
-
-	when( true ) waitfor( x );
-	or when( true ) else;
-
-	when( true ) waitfor( x : z );
-	or when( true ) else;
-
-	waitfor( x ) {
-	} or when( true ) else {
-	}
-
-	when( true ) waitfor( x ) {
-	} or when( true ) else {
-	}
-
-	waitfor( x );
-	or when( true ) else {
-	}
-
-	when( true ) waitfor( x );
-	or when( true ) else {
-	}
-
-	when( true ) waitfor( x : z );
-	or when( true ) else {
-	}
-
-	waitfor( x ) {
-	} or when( true ) else;
-
-	when( true ) waitfor( x ) {
-	} or when( true ) else;
-
-	// test when, waitfor and timeout
-
-	waitfor( x );
-	or timeout( 3 );
-
-	waitfor( x : z );
-	or timeout( 3 );
-
-	when( true ) waitfor( x );
-	or timeout( 3 );
-
-	waitfor( x ) {
-	} or timeout( 3 ) {
-	}
-
-	when( true ) waitfor( x ) {
-	} or timeout( 3 ) {
-	}
-
-	when( true ) waitfor( x : z ) {
-	} or timeout( 3 ) {
-	}
-
-	when( true ) waitfor( x ) {
-	} or when ( true ) timeout( 3 ) {
-	}
-
-	when( true ) waitfor( x : z ) {
-	} or when ( true ) timeout( 3 ) {
-	}
-
-	waitfor( x );
-	or timeout( 3 ) {
-	}
-
-	when( true ) waitfor( x );
-	or timeout( 3 ) {
-	}
-
-	when( true ) waitfor( x );
-	or when( true ) timeout( 3 ) {
-	}
-
-	waitfor( x ) {
-	} or timeout( 3 );
-
-	when( true ) waitfor( x ) {
-	} or timeout( 3 );
-
-	when( true ) waitfor( x ) {
-	} or when( true ) timeout( 3 );
-
-	// test when, waitfor, timeout and else
-
-	waitfor( x ) {
-	} or timeout( 3 ) {
-	} or when( true ) else {}
-
-	when( true ) waitfor( x ) {
-	} or timeout( 3 ) {
-	} or when( true ) else {}
-
-	waitfor( x ) {
-	} or timeout( 3 ) {
-	} or when( true ) else {}
-
-	waitfor( x ) {
-	} or when( true ) timeout( 3 ) {
-	} or when( true ) else {}
-
-	when( true ) waitfor( x ) {
-	} or timeout( 3 ) {
-	} or when( true ) else {}
-
-	waitfor( x ) {
-	} or when( true ) timeout( 3 ) {
-	} or when( true ) else {}
-
-	when( true ) waitfor( x ) {
-	} or when( true ) timeout( 3 ) {
-	} or when( true ) else {}
-
-	// test quasi-keywords "or" and "timeout"
-
-	int or, timeout;
-	waitfor( timeout : 7 ) 3;
-	waitfor( timeout : 7 ) 3; or waitfor( timeout : 7 ) 3;
-	when( or ) waitfor( or : ) { 4; } or timeout( 1 ) 3;
-	when( 3 ) waitfor( or : 2 ) 4; or else 4;
-	when( 3 ) waitfor( or : 3 ) 4; or when( or ) timeout( or ) 4; or when( or ) else timeout;
-	when( 3 ) waitfor( or : or ) 3; or when( or ) waitfor( or : timeout ) 4; or else 4;
-	when( 3 ) waitfor( or : or ) 3; or waitfor( or : 9 ) 4; or when( or ) timeout( timeout ) 4;
-	when( 3 ) waitfor( or : 3 ) 3; or waitfor( or : 7 ) or; or timeout( 1 ) or; or when( 3 ) else or;
-
-	// test else selection
-
-	if ( or > timeout ) waitfor( or ) 3;
-	else waitfor( timeout ) 4;
-}
-
-// Local Variables: //
-// tab-width: 4 //
-// compile-command: "cfa waitfor.cfa" //
-// End: //
Index: tests/pybin/settings.py
===================================================================
--- tests/pybin/settings.py	(revision a50fdfbfae933dc68ef63eb07fe97924c504fe1b)
+++ tests/pybin/settings.py	(revision 6e1e2d0299e4210d269f7a30ec3864a8bddceabb)
@@ -126,4 +126,5 @@
 	global archive
 	global install
+	global invariant
 
 	global continue_
@@ -140,4 +141,5 @@
 	all_install  = [Install(o)      for o in list(dict.fromkeys(options.install))]
 	archive      = os.path.abspath(os.path.join(original_path, options.archive_errors)) if options.archive_errors else None
+	invariant    = options.invariant
 	continue_    = options.continue_
 	dry_run      = options.dry_run # must be called before tools.config_hash()
Index: tests/test.py
===================================================================
--- tests/test.py	(revision a50fdfbfae933dc68ef63eb07fe97924c504fe1b)
+++ tests/test.py	(revision 6e1e2d0299e4210d269f7a30ec3864a8bddceabb)
@@ -114,4 +114,5 @@
 	parser.add_argument('--install', help='Run all tests based on installed binaries or tree binaries', type=comma_separated(yes_no), default='no')
 	parser.add_argument('--continue', help='When multiple specifications are passed (debug/install/arch), sets whether or not to continue if the last specification failed', type=yes_no, default='yes', dest='continue_')
+	parser.add_argument('--invariant', help='Tell the compiler to check invariants while running.', action='store_true')
 	parser.add_argument('--timeout', help='Maximum duration in seconds after a single test is considered to have timed out', type=int, default=180)
 	parser.add_argument('--global-timeout', help='Maximum cumulative duration in seconds after the ALL tests are considered to have timed out', type=int, default=7200)
@@ -172,4 +173,7 @@
 	test.prepare()
 
+	# extra flags for cfa to pass through make.
+	cfa_flags = 'CFAFLAGS=--invariant' if settings.invariant else None
+
 	# ----------
 	# MAKE
@@ -177,5 +181,5 @@
 	# build, skipping to next test on error
 	with Timed() as comp_dur:
-		make_ret, _, _ = make( test.target(), output_file=subprocess.DEVNULL, error=out_file, error_file = err_file )
+		make_ret, _, _ = make(test.target(), flags=cfa_flags, output_file=subprocess.DEVNULL, error=out_file, error_file=err_file)
 
 	# ----------
Index: tests/zombies/gc_no_raii/bug-repro/deref.c
===================================================================
--- tests/zombies/gc_no_raii/bug-repro/deref.c	(revision a50fdfbfae933dc68ef63eb07fe97924c504fe1b)
+++ tests/zombies/gc_no_raii/bug-repro/deref.c	(revision 6e1e2d0299e4210d269f7a30ec3864a8bddceabb)
Index: tests/zombies/gc_no_raii/bug-repro/malloc.c
===================================================================
--- tests/zombies/gc_no_raii/bug-repro/malloc.c	(revision a50fdfbfae933dc68ef63eb07fe97924c504fe1b)
+++ tests/zombies/gc_no_raii/bug-repro/malloc.c	(revision 6e1e2d0299e4210d269f7a30ec3864a8bddceabb)
Index: tests/zombies/gc_no_raii/bug-repro/zero.c
===================================================================
--- tests/zombies/gc_no_raii/bug-repro/zero.c	(revision a50fdfbfae933dc68ef63eb07fe97924c504fe1b)
+++ tests/zombies/gc_no_raii/bug-repro/zero.c	(revision 6e1e2d0299e4210d269f7a30ec3864a8bddceabb)
Index: tests/zombies/gc_no_raii/test/operators.c
===================================================================
--- tests/zombies/gc_no_raii/test/operators.c	(revision a50fdfbfae933dc68ef63eb07fe97924c504fe1b)
+++ tests/zombies/gc_no_raii/test/operators.c	(revision 6e1e2d0299e4210d269f7a30ec3864a8bddceabb)
