Index: doc/LaTeXmacros/common.sty
===================================================================
--- doc/LaTeXmacros/common.sty	(revision 21a99ccc1c184c5bca78dca70582d46fc6488bc3)
+++ doc/LaTeXmacros/common.sty	(revision a554e5f423752296e46ab9ced5a34d32676e55d5)
@@ -11,6 +11,6 @@
 %% Created On       : Sat Apr  9 10:06:17 2016
 %% Last Modified By : Peter A. Buhr
-%% Last Modified On : Mon May 31 09:08:37 2021
-%% Update Count     : 565
+%% Last Modified On : Mon Feb  7 23:00:46 2022
+%% Update Count     : 569
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
@@ -43,4 +43,5 @@
 \newcommand{\CCIcon}{\textrm{C}\kern-.1em\hbox{+\kern-.25em+}} % C++ icon
 \newcommand{\CC}[1][]{\protect\CCIcon{#1}\xspace}		% C++ symbolic name
+\newcommand{\Cpp}[1][]{\CC{#1}}							% C++ synonym
 % numbers disallowed in latex variables names => use number names
 \newcommand{\CCeleven}{\protect\CCIcon{11}\xspace}		% C++11 symbolic name
@@ -51,4 +52,9 @@
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\usepackage{pslatex}									% reduce size of san serif font
+\usepackage{relsize}									% must be after change to small or selects old size
+\usepackage{rotating}
+\usepackage{calc}										% latex arithmetic
 
 % remove special-character warning in PDF side-bar names
@@ -71,9 +77,4 @@
 \newlength{\parindentlnth}
 \setlength{\parindentlnth}{\parindent}
-
-\usepackage{pslatex}									% reduce size of san serif font
-\usepackage{relsize}									% must be after change to small or selects old size
-\usepackage{rotating}
-\usepackage{calc}										% latex arithmetic
 
 % reduce size of chapter/section titles
@@ -151,4 +152,25 @@
 \newcommand{\@snewterm}[2][\@empty]{{\newtermFontInline{#2}}\ifx#1\@empty\index{#2}\else\index{#1@{\protect#2}}\fi}
 
+% \snake{<identifier>}
+% Improves writing of snake case (or any convention that uses _) by allowing
+% line breaks after _. Disables commands inside the block and formats the
+% identifier to look like code.
+\newcommand*\snake[1]{\snakefont{\expandafter\snake@next\detokenize{#1}\@nil}}
+
+% \snakefont{<text>}
+% Command used by \snake, you may renew the command to change its formating.
+\newcommand*\snakefont[1]{\LstBasicStyle{#1}}
+
+% Thanks Manuel of TeX Stack exchange. (I got the base pattern from one of
+% their answers.) Note: \@nil should never be defined.
+\newcommand*\snake@next[1]{\ifx\@nil#1\else
+  \expandafter\ifx\string_#1\string_\allowbreak\else#1\fi
+  \expandafter\snake@next\fi
+}
+
+% \lang{<language>}{<code>}
+% Use the listings package to format the snipit of <code> in <language>.
+\newcommand{\lang}[2]{\lstinline[language=#1]{#2}}
+
 % Latin abbreviation
 \newcommand{\abbrevFont}{\textit}			% set empty for no italics
@@ -263,5 +285,5 @@
 extendedchars=true,						% allow ASCII characters in the range 128-255
 escapechar=\$,							% LaTeX escape in CFA code §...§ (section symbol), emacs: C-q M-'
-mathescape=false,						% LaTeX math escape in CFA code $...$
+mathescape=false,						% disable LaTeX math escape in CFA code $...$
 keepspaces=true,						%
 showstringspaces=false,					% do not show spaces with cup
@@ -308,7 +330,5 @@
 }{}
 % inline code @...@ (at symbol)
-\makeatother
 \lstMakeShortInline@					% single-character for \lstinline
-\makeatletter
 \fi%
 
Index: doc/LaTeXmacros/common.tex
===================================================================
--- doc/LaTeXmacros/common.tex	(revision 21a99ccc1c184c5bca78dca70582d46fc6488bc3)
+++ doc/LaTeXmacros/common.tex	(revision a554e5f423752296e46ab9ced5a34d32676e55d5)
@@ -11,6 +11,6 @@
 %% Created On       : Sat Apr  9 10:06:17 2016
 %% Last Modified By : Peter A. Buhr
-%% Last Modified On : Mon May 31 09:10:49 2021
-%% Update Count     : 546
+%% Last Modified On : Mon Feb  7 23:00:08 2022
+%% Update Count     : 552
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
@@ -43,4 +43,5 @@
 \newcommand{\CCIcon}{\textrm{C}\kern-.1em\hbox{+\kern-.25em+}} % C++ icon
 \newcommand{\CC}[1][]{\protect\CCIcon{#1}\xspace}		% C++ symbolic name
+\newcommand{\Cpp}[1][]{\CC{#1}}							% C++ synonym
 % numbers disallowed in latex variables names => use number names
 \newcommand{\CCeleven}{\protect\CCIcon{11}\xspace}		% C++11 symbolic name
@@ -51,4 +52,9 @@
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\usepackage{pslatex}									% reduce size of san serif font
+\usepackage{relsize}									% must be after change to small or selects old size
+\usepackage{rotating}
+\usepackage{calc}										% latex arithmetic
 
 % remove special-character warning in PDF side-bar names
@@ -72,9 +78,4 @@
 \newlength{\parindentlnth}
 \setlength{\parindentlnth}{\parindent}
-
-\usepackage{pslatex}									% reduce size of san serif font
-\usepackage{relsize}									% must be after change to small or selects old size
-\usepackage{rotating}
-\usepackage{calc}										% latex arithmetic
 
 % reduce size of chapter/section titles
@@ -152,4 +153,25 @@
 \newcommand{\@snewterm}[2][\@empty]{{\newtermFontInline{#2}}\ifx#1\@empty\index{#2}\else\index{#1@{\protect#2}}\fi}
 
+% \snake{<identifier>}
+% Improves writing of snake case (or any convention that uses _) by allowing
+% line breaks after _. Disables commands inside the block and formats the
+% identifier to look like code.
+\newcommand*\snake[1]{\snakefont{\expandafter\snake@next\detokenize{#1}\@nil}}
+
+% \snakefont{<text>}
+% Command used by \snake, you may renew the command to change its formating.
+\newcommand*\snakefont[1]{\LstBasicStyle{#1}}
+
+% Thanks Manuel of TeX Stack exchange. (I got the base pattern from one of
+% their answers.) Note: \@nil should never be defined.
+\newcommand*\snake@next[1]{\ifx\@nil#1\else
+  \expandafter\ifx\string_#1\string_\allowbreak\else#1\fi
+  \expandafter\snake@next\fi
+}
+
+% \lang{<language>}{<code>}
+% Use the listings package to format the snipit of <code> in <language>.
+\newcommand{\lang}[2]{\lstinline[language=#1]{#2}}
+
 % Latin abbreviation
 \newcommand{\abbrevFont}{\textit}			% set empty for no italics
@@ -268,5 +290,5 @@
 extendedchars=true,						% allow ASCII characters in the range 128-255
 escapechar=\$,							% LaTeX escape in CFA code §...§ (section symbol), emacs: C-q M-'
-mathescape=false,						% LaTeX math escape in CFA code $...$
+mathescape=false,						% disable LaTeX math escape in CFA code $...$
 keepspaces=true,						%
 showstringspaces=false,					% do not show spaces with cup
Index: doc/theses/thierry_delisle_PhD/thesis/Makefile
===================================================================
--- doc/theses/thierry_delisle_PhD/thesis/Makefile	(revision 21a99ccc1c184c5bca78dca70582d46fc6488bc3)
+++ doc/theses/thierry_delisle_PhD/thesis/Makefile	(revision a554e5f423752296e46ab9ced5a34d32676e55d5)
@@ -48,5 +48,5 @@
 ## Define the documents that need to be made.
 all: thesis.pdf
-thesis.pdf: ${TEXTS} ${FIGURES} ${PICTURES} thesis.tex glossary.tex local.bib
+thesis.pdf: ${TEXTS} ${FIGURES} ${PICTURES} thesis.tex glossary.tex local.bib ../../../LaTeXmacros/common.tex ../../../LaTeXmacros/common.sty
 
 DOCUMENT = thesis.pdf
Index: libcfa/src/concurrency/preemption.cfa
===================================================================
--- libcfa/src/concurrency/preemption.cfa	(revision 21a99ccc1c184c5bca78dca70582d46fc6488bc3)
+++ libcfa/src/concurrency/preemption.cfa	(revision a554e5f423752296e46ab9ced5a34d32676e55d5)
@@ -251,7 +251,18 @@
 	bool enabled = __cfaabi_tls.preemption_state.enabled;
 
+	// Check if there is a pending preemption
+	processor   * proc = __cfaabi_tls.this_processor;
+	bool pending = proc ? proc->pending_preemption : false;
+	if( enabled && pending ) proc->pending_preemption = false;
+
 	// create a assembler label after
 	// marked as clobber all to avoid movement
 	__cfaasm_label(check, after);
+
+	// If we can preempt and there is a pending one
+	// this is a good time to yield
+	if( enabled && pending ) {
+		force_yield( __POLL_PREEMPTION );
+	}
 	return enabled;
 }
@@ -282,4 +293,6 @@
 	// marked as clobber all to avoid movement
 	__cfaasm_label(get, after);
+
+	// This is used everywhere, to avoid cost, we DO NOT poll pending preemption
 	return val;
 }
@@ -358,24 +371,20 @@
 	if(!ready) { abort("Preemption should be ready"); }
 
-	__cfaasm_label(debug, before);
-
-		sigset_t oldset;
-		int ret;
-		ret = pthread_sigmask(0, ( const sigset_t * ) 0p, &oldset);  // workaround trac#208: cast should be unnecessary
-		if(ret != 0) { abort("ERROR sigprocmask returned %d", ret); }
-
-		ret = sigismember(&oldset, SIGUSR1);
-		if(ret <  0) { abort("ERROR sigismember returned %d", ret); }
-		if(ret == 1) { abort("ERROR SIGUSR1 is disabled"); }
-
-		ret = sigismember(&oldset, SIGALRM);
-		if(ret <  0) { abort("ERROR sigismember returned %d", ret); }
-		if(ret == 0) { abort("ERROR SIGALRM is enabled"); }
-
-		ret = sigismember(&oldset, SIGTERM);
-		if(ret <  0) { abort("ERROR sigismember returned %d", ret); }
-		if(ret == 1) { abort("ERROR SIGTERM is disabled"); }
-
-	__cfaasm_label(debug, after);
+	sigset_t oldset;
+	int ret;
+	ret = pthread_sigmask(0, ( const sigset_t * ) 0p, &oldset);  // workaround trac#208: cast should be unnecessary
+	if(ret != 0) { abort("ERROR sigprocmask returned %d", ret); }
+
+	ret = sigismember(&oldset, SIGUSR1);
+	if(ret <  0) { abort("ERROR sigismember returned %d", ret); }
+	if(ret == 1) { abort("ERROR SIGUSR1 is disabled"); }
+
+	ret = sigismember(&oldset, SIGALRM);
+	if(ret <  0) { abort("ERROR sigismember returned %d", ret); }
+	if(ret == 0) { abort("ERROR SIGALRM is enabled"); }
+
+	ret = sigismember(&oldset, SIGTERM);
+	if(ret <  0) { abort("ERROR sigismember returned %d", ret); }
+	if(ret == 1) { abort("ERROR SIGTERM is disabled"); }
 }
 
@@ -548,5 +557,5 @@
 	__cfaasm_label( check  );
 	__cfaasm_label( dsable );
-	__cfaasm_label( debug  );
+	// __cfaasm_label( debug  );
 
 	// Check if preemption is safe
@@ -555,5 +564,5 @@
 	if( __cfaasm_in( ip, check  ) ) { ready = false; goto EXIT; };
 	if( __cfaasm_in( ip, dsable ) ) { ready = false; goto EXIT; };
-	if( __cfaasm_in( ip, debug  ) ) { ready = false; goto EXIT; };
+	// if( __cfaasm_in( ip, debug  ) ) { ready = false; goto EXIT; };
 	if( !__cfaabi_tls.preemption_state.enabled) { ready = false; goto EXIT; };
 	if( __cfaabi_tls.preemption_state.in_progress ) { ready = false; goto EXIT; };
@@ -661,5 +670,10 @@
 
 	// Check if it is safe to preempt here
-	if( !preemption_ready( ip ) ) { return; }
+	if( !preemption_ready( ip ) ) {
+		#if !defined(__CFA_NO_STATISTICS__)
+			__cfaabi_tls.this_stats->ready.threads.preempt.rllfwd++;
+		#endif
+		return;
+	}
 
 	__cfaabi_dbg_print_buffer_decl( " KERNEL: preempting core %p (%p @ %p).\n", __cfaabi_tls.this_processor, __cfaabi_tls.this_thread, (void *)(cxt->uc_mcontext.CFA_REG_IP) );
@@ -680,4 +694,8 @@
 
 	// Preemption can occur here
+
+	#if !defined(__CFA_NO_STATISTICS__)
+		__cfaabi_tls.this_stats->ready.threads.preempt.yield++;
+	#endif
 
 	force_yield( __ALARM_PREEMPTION ); // Do the actual __cfactx_switch
Index: libcfa/src/concurrency/stats.cfa
===================================================================
--- libcfa/src/concurrency/stats.cfa	(revision 21a99ccc1c184c5bca78dca70582d46fc6488bc3)
+++ libcfa/src/concurrency/stats.cfa	(revision a554e5f423752296e46ab9ced5a34d32676e55d5)
@@ -29,4 +29,6 @@
 		stats->ready.threads.threads   = 0;
 		stats->ready.threads.cthreads  = 0;
+		stats->ready.threads.preempt.yield  = 0;
+		stats->ready.threads.preempt.rllfwd = 0;
 		stats->ready.sleep.halts   = 0;
 		stats->ready.sleep.cancels = 0;
@@ -77,28 +79,30 @@
 
 	void __tally_stats( struct __stats_t * cltr, struct __stats_t * proc ) {
-		tally_one( &cltr->ready.push.local.attempt, &proc->ready.push.local.attempt );
-		tally_one( &cltr->ready.push.local.success, &proc->ready.push.local.success );
-		tally_one( &cltr->ready.push.share.attempt, &proc->ready.push.share.attempt );
-		tally_one( &cltr->ready.push.share.success, &proc->ready.push.share.success );
-		tally_one( &cltr->ready.push.extrn.attempt, &proc->ready.push.extrn.attempt );
-		tally_one( &cltr->ready.push.extrn.success, &proc->ready.push.extrn.success );
-		tally_one( &cltr->ready.pop.local .attempt, &proc->ready.pop.local .attempt );
-		tally_one( &cltr->ready.pop.local .success, &proc->ready.pop.local .success );
-		tally_one( &cltr->ready.pop.help  .attempt, &proc->ready.pop.help  .attempt );
-		tally_one( &cltr->ready.pop.help  .success, &proc->ready.pop.help  .success );
-		tally_one( &cltr->ready.pop.steal .attempt, &proc->ready.pop.steal .attempt );
-		tally_one( &cltr->ready.pop.steal .success, &proc->ready.pop.steal .success );
-		tally_one( &cltr->ready.pop.search.attempt, &proc->ready.pop.search.attempt );
-		tally_one( &cltr->ready.pop.search.success, &proc->ready.pop.search.success );
-		tally_one( &cltr->ready.threads.migration , &proc->ready.threads.migration  );
-		tally_one( &cltr->ready.threads.extunpark , &proc->ready.threads.extunpark  );
-		tally_one( &cltr->ready.threads.threads   , &proc->ready.threads.threads    );
-		tally_one( &cltr->ready.threads.cthreads  , &proc->ready.threads.cthreads   );
-		tally_one( &cltr->ready.sleep.halts       , &proc->ready.sleep.halts        );
-		tally_one( &cltr->ready.sleep.cancels     , &proc->ready.sleep.cancels      );
-		tally_one( &cltr->ready.sleep.early       , &proc->ready.sleep.early        );
-		tally_one( &cltr->ready.sleep.wakes       , &proc->ready.sleep.wakes        );
-		tally_one( &cltr->ready.sleep.seen        , &proc->ready.sleep.wakes        );
-		tally_one( &cltr->ready.sleep.exits       , &proc->ready.sleep.exits        );
+		tally_one( &cltr->ready.push.local.attempt    , &proc->ready.push.local.attempt     );
+		tally_one( &cltr->ready.push.local.success    , &proc->ready.push.local.success     );
+		tally_one( &cltr->ready.push.share.attempt    , &proc->ready.push.share.attempt     );
+		tally_one( &cltr->ready.push.share.success    , &proc->ready.push.share.success     );
+		tally_one( &cltr->ready.push.extrn.attempt    , &proc->ready.push.extrn.attempt     );
+		tally_one( &cltr->ready.push.extrn.success    , &proc->ready.push.extrn.success     );
+		tally_one( &cltr->ready.pop.local .attempt    , &proc->ready.pop.local .attempt     );
+		tally_one( &cltr->ready.pop.local .success    , &proc->ready.pop.local .success     );
+		tally_one( &cltr->ready.pop.help  .attempt    , &proc->ready.pop.help  .attempt     );
+		tally_one( &cltr->ready.pop.help  .success    , &proc->ready.pop.help  .success     );
+		tally_one( &cltr->ready.pop.steal .attempt    , &proc->ready.pop.steal .attempt     );
+		tally_one( &cltr->ready.pop.steal .success    , &proc->ready.pop.steal .success     );
+		tally_one( &cltr->ready.pop.search.attempt    , &proc->ready.pop.search.attempt     );
+		tally_one( &cltr->ready.pop.search.success    , &proc->ready.pop.search.success     );
+		tally_one( &cltr->ready.threads.migration     , &proc->ready.threads.migration      );
+		tally_one( &cltr->ready.threads.extunpark     , &proc->ready.threads.extunpark      );
+		tally_one( &cltr->ready.threads.threads       , &proc->ready.threads.threads        );
+		tally_one( &cltr->ready.threads.cthreads      , &proc->ready.threads.cthreads       );
+		tally_one( &cltr->ready.threads.preempt.yield , &proc->ready.threads.preempt.yield  );
+		tally_one( &cltr->ready.threads.preempt.rllfwd, &proc->ready.threads.preempt.rllfwd );
+		tally_one( &cltr->ready.sleep.halts           , &proc->ready.sleep.halts            );
+		tally_one( &cltr->ready.sleep.cancels         , &proc->ready.sleep.cancels          );
+		tally_one( &cltr->ready.sleep.early           , &proc->ready.sleep.early            );
+		tally_one( &cltr->ready.sleep.wakes           , &proc->ready.sleep.wakes            );
+		tally_one( &cltr->ready.sleep.seen            , &proc->ready.sleep.wakes            );
+		tally_one( &cltr->ready.sleep.exits           , &proc->ready.sleep.exits            );
 
 		#if defined(CFA_HAVE_LINUX_IO_URING_H)
@@ -168,4 +172,5 @@
 			     | eng3(ready.sleep.wakes + ready.sleep.early) | '(' | eng3(ready.sleep.early) | ',' | eng3(ready.sleep.seen) | ')' | " wake(early, seen),"
 			     | eng3(ready.sleep.exits) | "exit";
+			sstr | "- Preemption : " | eng3(ready.threads.preempt.yield) | "yields," | eng3(ready.threads.preempt.rllfwd) | "delayed";
 			sstr | nl;
 		}
Index: libcfa/src/concurrency/stats.hfa
===================================================================
--- libcfa/src/concurrency/stats.hfa	(revision 21a99ccc1c184c5bca78dca70582d46fc6488bc3)
+++ libcfa/src/concurrency/stats.hfa	(revision a554e5f423752296e46ab9ced5a34d32676e55d5)
@@ -65,4 +65,8 @@
 			volatile  int64_t threads;  // number of threads in the system, includes only local change
 			volatile  int64_t cthreads; // number of threads in the system, includes only local change
+			struct {
+				volatile uint64_t yield;
+				volatile uint64_t rllfwd;
+			} preempt;
 		} threads;
 		struct {
Index: libcfa/src/stdhdr/pthread.h
===================================================================
--- libcfa/src/stdhdr/pthread.h	(revision 21a99ccc1c184c5bca78dca70582d46fc6488bc3)
+++ libcfa/src/stdhdr/pthread.h	(revision a554e5f423752296e46ab9ced5a34d32676e55d5)
@@ -10,15 +10,34 @@
 // Created On       : Wed Jun 16 13:39:06 2021
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Wed Jun 16 13:39:42 2021
-// Update Count     : 1
+// Last Modified On : Thu Feb  3 21:53:26 2022
+// Update Count     : 13
 // 
 
+// pthread.h and setjmp.h cannot agree on the type of __sigsetjmp:
+//
+//   extern int __sigsetjmp (struct __jmp_buf_tag *__env, int __savemask) __attribute__ ((__nothrow__));
+//   extern int __sigsetjmp (struct __jmp_buf_tag __env[1], int __savemask) __attribute__ ((__nothrow__));
+//
+// With -Wall, gcc-11 warns about the disagreement unless the CPP directive
+//
+//    # 1 "/usr/include/pthread.h" 1 3 4
+//
+// appears, which appears to be witchcraft. Unfortunately, this directive is removed by the CFA preprocessor, so the
+// batchtest fails because of the spurious warning message. Hence, the warning is elided.
+
 extern "C" {
+#if defined(__GNUC__) && __GNUC__ == 11
+	#pragma GCC diagnostic push
+	#pragma GCC diagnostic ignored "-Warray-parameter"
+#endif // defined(__GNUC__) && __GNUC__ == 11
+
 #include_next <pthread.h>								// has internal check for multiple expansion
+
+#if defined(__GNUC__) && __GNUC__ == 11
+	#pragma GCC diagnostic pop
+#endif // defined(__GNUC__) && __GNUC__ == 11
 } // extern "C"
 
 // Local Variables: //
-// tab-width: 4 //
 // mode: c++ //
-// compile-command: "make install" //
 // End: //
Index: libcfa/src/stdhdr/setjmp.h
===================================================================
--- libcfa/src/stdhdr/setjmp.h	(revision 21a99ccc1c184c5bca78dca70582d46fc6488bc3)
+++ libcfa/src/stdhdr/setjmp.h	(revision a554e5f423752296e46ab9ced5a34d32676e55d5)
@@ -10,15 +10,34 @@
 // Created On       : Mon Jul  4 23:25:26 2016
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Tue Jul  5 20:38:33 2016
-// Update Count     : 12
+// Last Modified On : Thu Feb  3 21:53:28 2022
+// Update Count     : 18
 // 
 
+// pthread.h and setjmp.h cannot agree on the type of __sigsetjmp:
+//
+//   extern int __sigsetjmp (struct __jmp_buf_tag *__env, int __savemask) __attribute__ ((__nothrow__));
+//   extern int __sigsetjmp (struct __jmp_buf_tag __env[1], int __savemask) __attribute__ ((__nothrow__));
+//
+// With -Wall, gcc-11 warns about the disagreement unless the CPP directive
+//
+//    # 1 "/usr/include/pthread.h" 1 3 4
+//
+// appears, which appears to be witchcraft. Unfortunately, this directive is removed by the CFA preprocessor, so the
+// batchtest fails because of the spurious warning message. Hence, the warning is elided.
+
 extern "C" {
+#if defined(__GNUC__) && __GNUC__ == 11
+	#pragma GCC diagnostic push
+	#pragma GCC diagnostic ignored "-Warray-parameter"
+#endif // defined(__GNUC__) && __GNUC__ == 11
+
 #include_next <setjmp.h>								// has internal check for multiple expansion
+
+#if defined(__GNUC__) && __GNUC__ == 11
+	#pragma GCC diagnostic pop
+#endif // defined(__GNUC__) && __GNUC__ == 11
 } // extern "C"
 
 // Local Variables: //
-// tab-width: 4 //
 // mode: c++ //
-// compile-command: "make install" //
 // End: //
Index: src/AST/Pass.hpp
===================================================================
--- src/AST/Pass.hpp	(revision 21a99ccc1c184c5bca78dca70582d46fc6488bc3)
+++ src/AST/Pass.hpp	(revision a554e5f423752296e46ab9ced5a34d32676e55d5)
@@ -238,31 +238,99 @@
 
 private:
-	const ast::Stmt * call_accept( const ast::Stmt * );
-	const ast::Expr * call_accept( const ast::Expr * );
-
-	// requests WithStmtsToAdd directly add to this statement, as if it is a compound.
-
-	const ast::Stmt * call_accept_as_compound(const ast::Stmt *);
-
+
+	// Regular nodes
 	template< typename node_t >
-	auto call_accept( const node_t * node ) -> typename std::enable_if<
+	struct result1 {
+		bool differs;
+		const node_t * value;
+
+		template< typename object_t, typename super_t, typename field_t >
+		void apply(object_t *, field_t super_t::* field);
+	};
+
+	result1<ast::Stmt> call_accept( const ast::Stmt * );
+	result1<ast::Expr> call_accept( const ast::Expr * );
+
+	template< typename node_t >
+	auto call_accept( const node_t * node )
+		-> typename std::enable_if<
 				!std::is_base_of<ast::Expr, node_t>::value &&
 				!std::is_base_of<ast::Stmt, node_t>::value
-			, decltype( node->accept(*this) )
+			, result1<
+				typename std::remove_pointer< decltype( node->accept(*this) ) >::type
+			>
 		>::type;
 
+	// requests WithStmtsToAdd directly add to this statement, as if it is a compound.
+	result1<ast::Stmt> call_accept_as_compound(const ast::Stmt *);
+
+	// Container of statements
 	template< template <class...> class container_t >
-	container_t< ptr<Stmt> > call_accept( const container_t< ptr<Stmt> > & );
-
+	struct resultNstmt {
+		struct delta {
+			ptr<Stmt> nval;
+			ssize_t old_idx;
+			bool is_old;
+
+			delta(const Stmt * s, ssize_t i, bool old) : nval{s}, old_idx{i}, is_old{old} {}
+		};
+
+		bool differs;
+		container_t< delta > values;
+
+		resultNstmt() : differs(false), values{} {}
+		resultNstmt(bool diff, container_t< delta > && vals) : differs(diff), values(vals) {}
+
+		template< typename object_t, typename super_t, typename field_t >
+		void apply(object_t *, field_t super_t::* field);
+
+		template< template <class...> class incontainer_t >
+		void take_all( incontainer_t<ast::ptr<ast::Stmt>> * stmts ) {
+			if(!stmts || stmts->empty()) return;
+
+			std::transform(stmts->begin(), stmts->end(), std::back_inserter( values ), [](ast::ptr<ast::Stmt>& decl) -> delta {
+					return delta( decl.release(), -1, false );
+				});
+			stmts->clear();
+			differs = true;
+		}
+
+		template< template <class...> class incontainer_t >
+		void take_all( incontainer_t<ast::ptr<ast::Decl>> * decls ) {
+			if(!decls || decls->empty()) return;
+
+			std::transform(decls->begin(), decls->end(), std::back_inserter( values ), [](ast::ptr<ast::Decl>& decl) -> auto {
+					auto loc = decl->location;
+					auto stmt = new DeclStmt( loc, decl.release() );
+					return delta( stmt, -1, false );
+				});
+			decls->clear();
+			differs = true;
+		}
+	};
+
+	template< template <class...> class container_t >
+	resultNstmt<container_t> call_accept( const container_t< ptr<Stmt> > & );
+
+	// Container of something
 	template< template <class...> class container_t, typename node_t >
-	container_t< ptr<node_t> > call_accept( const container_t< ptr<node_t> > & container );
+	struct resultN {
+		bool differs;
+		container_t<ptr<node_t>> values;
+
+		template< typename object_t, typename super_t, typename field_t >
+		void apply(object_t *, field_t super_t::* field);
+	};
+
+	template< template <class...> class container_t, typename node_t >
+	resultN< container_t, node_t > call_accept( const container_t< ptr<node_t> > & container );
 
 public:
 	/// Logic to call the accept and mutate the parent if needed, delegates call to accept
-	template<typename node_t, typename parent_t, typename child_t>
-	void maybe_accept(const node_t * &, child_t parent_t::* child);
-
-	template<typename node_t, typename parent_t, typename child_t>
-	void maybe_accept_as_compound(const node_t * &, child_t parent_t::* child);
+	template<typename node_t, typename parent_t, typename field_t>
+	void maybe_accept(const node_t * &, field_t parent_t::* field);
+
+	template<typename node_t, typename parent_t, typename field_t>
+	void maybe_accept_as_compound(const node_t * &, field_t parent_t::* field);
 
 private:
Index: src/AST/Pass.impl.hpp
===================================================================
--- src/AST/Pass.impl.hpp	(revision 21a99ccc1c184c5bca78dca70582d46fc6488bc3)
+++ src/AST/Pass.impl.hpp	(revision a554e5f423752296e46ab9ced5a34d32676e55d5)
@@ -79,9 +79,9 @@
 
 		template<typename it_t, template <class...> class container_t>
-		static inline void take_all( it_t it, container_t<ast::ptr<ast::Stmt>> * decls, bool * mutated = nullptr ) {
-			if(empty(decls)) return;
-
-			std::move(decls->begin(), decls->end(), it);
-			decls->clear();
+		static inline void take_all( it_t it, container_t<ast::ptr<ast::Stmt>> * stmts, bool * mutated = nullptr ) {
+			if(empty(stmts)) return;
+
+			std::move(stmts->begin(), stmts->end(), it);
+			stmts->clear();
 			if(mutated) *mutated = true;
 		}
@@ -123,4 +123,12 @@
 			return !new_val.empty();
 		}
+	}
+
+
+	template< typename core_t >
+	template< typename node_t >
+	template< typename object_t, typename super_t, typename field_t >
+	void ast::Pass< core_t >::result1< node_t >::apply(object_t * object, field_t super_t::* field) {
+		object->*field = value;
 	}
 
@@ -131,5 +139,7 @@
 				!std::is_base_of<ast::Expr, node_t>::value &&
 				!std::is_base_of<ast::Stmt, node_t>::value
-			, decltype( node->accept(*this) )
+			, ast::Pass< core_t >::result1<
+				typename std::remove_pointer< decltype( node->accept(*this) ) >::type
+			>
 		>::type
 	{
@@ -140,9 +150,15 @@
 		static_assert( !std::is_base_of<ast::Stmt, node_t>::value, "ERROR");
 
-		return node->accept( *this );
+		auto nval = node->accept( *this );
+		ast::Pass< core_t >::result1<
+			typename std::remove_pointer< decltype( node->accept(*this) ) >::type
+		> res;
+		res.differs = nval != node;
+		res.value = nval;
+		return res;
 	}
 
 	template< typename core_t >
-	const ast::Expr * ast::Pass< core_t >::call_accept( const ast::Expr * expr ) {
+	typename ast::Pass< core_t >::template result1<ast::Expr> ast::Pass< core_t >::call_accept( const ast::Expr * expr ) {
 		__pedantic_pass_assert( __visit_children() );
 		__pedantic_pass_assert( expr );
@@ -153,17 +169,19 @@
 		}
 
-		return expr->accept( *this );
+		auto nval = expr->accept( *this );
+		return { nval != expr, nval };
 	}
 
 	template< typename core_t >
-	const ast::Stmt * ast::Pass< core_t >::call_accept( const ast::Stmt * stmt ) {
+	typename ast::Pass< core_t >::template result1<ast::Stmt> ast::Pass< core_t >::call_accept( const ast::Stmt * stmt ) {
 		__pedantic_pass_assert( __visit_children() );
 		__pedantic_pass_assert( stmt );
 
-		return stmt->accept( *this );
+		const ast::Stmt * nval = stmt->accept( *this );
+		return { nval != stmt, nval };
 	}
 
 	template< typename core_t >
-	const ast::Stmt * ast::Pass< core_t >::call_accept_as_compound( const ast::Stmt * stmt ) {
+	typename ast::Pass< core_t >::template result1<ast::Stmt> ast::Pass< core_t >::call_accept_as_compound( const ast::Stmt * stmt ) {
 		__pedantic_pass_assert( __visit_children() );
 		__pedantic_pass_assert( stmt );
@@ -190,5 +208,5 @@
 		// If the pass doesn't want to add anything then we are done
 		if( empty(stmts_before) && empty(stmts_after) && empty(decls_before) && empty(decls_after) ) {
-			return nstmt;
+			return { nstmt != stmt, nstmt };
 		}
 
@@ -212,10 +230,33 @@
 		__pass::take_all( std::back_inserter( compound->kids ), stmts_after );
 
-		return compound;
+		return {true, compound};
 	}
 
 	template< typename core_t >
 	template< template <class...> class container_t >
-	container_t< ptr<Stmt> > ast::Pass< core_t >::call_accept( const container_t< ptr<Stmt> > & statements ) {
+	template< typename object_t, typename super_t, typename field_t >
+	void ast::Pass< core_t >::resultNstmt<container_t>::apply(object_t * object, field_t super_t::* field) {
+		auto & container = object->*field;
+		__pedantic_pass_assert( container.size() <= values.size() );
+
+		auto cit = enumerate(container).begin();
+
+		container_t<ptr<Stmt>> nvals;
+		for(delta & d : values) {
+			if( d.is_old ) {
+				__pedantic_pass_assert( cit.idx <= d.old_idx );
+				std::advance( cit, d.old_idx - cit.idx );
+				nvals.push_back( std::move( (*cit).val) );
+			} else {
+				nvals.push_back( std::move(d.nval) );
+			}
+		}
+
+		object->*field = std::move(nvals);
+	}
+
+	template< typename core_t >
+	template< template <class...> class container_t >
+	typename ast::Pass< core_t >::template resultNstmt<container_t> ast::Pass< core_t >::call_accept( const container_t< ptr<Stmt> > & statements ) {
 		__pedantic_pass_assert( __visit_children() );
 		if( statements.empty() ) return {};
@@ -244,12 +285,13 @@
 		pass_visitor_stats.avg->push(pass_visitor_stats.depth);
 
-		bool mutated = false;
-		container_t< ptr<Stmt> > new_kids;
-		for( const Stmt * stmt : statements ) {
+		resultNstmt<container_t> new_kids;
+		for( auto value : enumerate( statements ) ) {
 			try {
+				size_t i = value.idx;
+				const Stmt * stmt = value.val;
 				__pedantic_pass_assert( stmt );
 				const ast::Stmt * new_stmt = stmt->accept( *this );
 				assert( new_stmt );
-				if(new_stmt != stmt ) mutated = true;
+				if(new_stmt != stmt ) { new_kids.differs = true; }
 
 				// Make sure that it is either adding statements or declartions but not both
@@ -261,13 +303,17 @@
 
 				// Take all the statements which should have gone after, N/A for first iteration
-				__pass::take_all( std::back_inserter( new_kids ), decls_before, &mutated );
-				__pass::take_all( std::back_inserter( new_kids ), stmts_before, &mutated );
+				new_kids.take_all( decls_before );
+				new_kids.take_all( stmts_before );
 
 				// Now add the statement if there is one
-				new_kids.emplace_back( new_stmt );
+				if(new_stmt != stmt) {
+					new_kids.values.emplace_back( new_stmt, i, false );
+				} else {
+					new_kids.values.emplace_back( nullptr, i, true );
+				}
 
 				// Take all the declarations that go before
-				__pass::take_all( std::back_inserter( new_kids ), decls_after, &mutated );
-				__pass::take_all( std::back_inserter( new_kids ), stmts_after, &mutated );
+				new_kids.take_all( decls_after );
+				new_kids.take_all( stmts_after );
 			}
 			catch ( SemanticErrorException &e ) {
@@ -278,10 +324,27 @@
 		if ( !errors.isEmpty() ) { throw errors; }
 
-		return mutated ? new_kids : container_t< ptr<Stmt> >();
+		return new_kids;
 	}
 
 	template< typename core_t >
 	template< template <class...> class container_t, typename node_t >
-	container_t< ast::ptr<node_t> > ast::Pass< core_t >::call_accept( const container_t< ast::ptr<node_t> > & container ) {
+	template< typename object_t, typename super_t, typename field_t >
+	void ast::Pass< core_t >::resultN<container_t, node_t>::apply(object_t * object, field_t super_t::* field) {
+		auto & container = object->*field;
+		__pedantic_pass_assert( container.size() == values.size() );
+
+		for(size_t i = 0; i < container.size(); i++) {
+			// Take all the elements that are different in 'values'
+			// and swap them into 'container'
+			if( values[i] != nullptr ) std::swap(container[i], values[i]);
+		}
+
+		// Now the original containers should still have the unchanged values
+		// but also contain the new values
+	}
+
+	template< typename core_t >
+	template< template <class...> class container_t, typename node_t >
+	typename ast::Pass< core_t >::template resultN<container_t, node_t> ast::Pass< core_t >::call_accept( const container_t< ast::ptr<node_t> > & container ) {
 		__pedantic_pass_assert( __visit_children() );
 		if( container.empty() ) return {};
@@ -293,12 +356,16 @@
 
 		bool mutated = false;
-		container_t< ast::ptr<node_t> > new_kids;
+		container_t<ptr<node_t>> new_kids;
 		for ( const node_t * node : container ) {
 			try {
 				__pedantic_pass_assert( node );
 				const node_t * new_stmt = strict_dynamic_cast< const node_t * >( node->accept( *this ) );
-				if(new_stmt != node ) mutated = true;
-
-				new_kids.emplace_back( new_stmt );
+				if(new_stmt != node ) {
+					mutated = true;
+					new_kids.emplace_back( new_stmt );
+				} else {
+					new_kids.emplace_back( nullptr );
+				}
+
 			}
 			catch( SemanticErrorException &e ) {
@@ -306,8 +373,10 @@
 			}
 		}
+
+		__pedantic_pass_assert( new_kids.size() == container.size() );
 		pass_visitor_stats.depth--;
 		if ( ! errors.isEmpty() ) { throw errors; }
 
-		return mutated ? new_kids : container_t< ast::ptr<node_t> >();
+		return ast::Pass< core_t >::resultN<container_t, node_t>{ mutated,  new_kids };
 	}
 
@@ -327,9 +396,9 @@
 		auto new_val = call_accept( old_val );
 
-		static_assert( !std::is_same<const ast::Node *, decltype(new_val)>::value || std::is_same<int, decltype(old_val)>::value, "ERROR");
-
-		if( __pass::differs(old_val, new_val) ) {
+		static_assert( !std::is_same<const ast::Node *, decltype(new_val)>::value /* || std::is_same<int, decltype(old_val)>::value */, "ERROR");
+
+		if( new_val.differs ) {
 			auto new_parent = __pass::mutate<core_t>(parent);
-			new_parent->*child = new_val;
+			new_val.apply(new_parent, child);
 			parent = new_parent;
 		}
@@ -353,7 +422,7 @@
 		static_assert( !std::is_same<const ast::Node *, decltype(new_val)>::value || std::is_same<int, decltype(old_val)>::value, "ERROR");
 
-		if( __pass::differs(old_val, new_val) ) {
+		if( new_val.differs ) {
 			auto new_parent = __pass::mutate<core_t>(parent);
-			new_parent->*child = new_val;
+			new_val.apply( new_parent, child );
 			parent = new_parent;
 		}
@@ -941,4 +1010,5 @@
 			const Expr * func = clause.target.func ? clause.target.func->accept(*this) : nullptr;
 			if(func != clause.target.func) mutated = true;
+			else func = nullptr;
 
 			std::vector<ptr<Expr>> new_args;
@@ -946,13 +1016,18 @@
 			for( const auto & arg : clause.target.args ) {
 				auto a = arg->accept(*this);
-				new_args.push_back( a );
-				if( a != arg ) mutated = true;
+				if( a != arg ) {
+					mutated = true;
+					new_args.push_back( a );
+				} else
+					new_args.push_back( nullptr );
 			}
 
 			const Stmt * stmt = clause.stmt ? clause.stmt->accept(*this) : nullptr;
 			if(stmt != clause.stmt) mutated = true;
+			else stmt = nullptr;
 
 			const Expr * cond = clause.cond ? clause.cond->accept(*this) : nullptr;
 			if(cond != clause.cond) mutated = true;
+			else cond = nullptr;
 
 			new_clauses.push_back( WaitForStmt::Clause{ {func, std::move(new_args) }, stmt, cond } );
@@ -961,5 +1036,14 @@
 		if(mutated) {
 			auto n = __pass::mutate<core_t>(node);
-			n->clauses = std::move( new_clauses );
+			for(size_t i = 0; i < new_clauses.size(); i++) {
+				if(new_clauses.at(i).target.func != nullptr) std::swap(n->clauses.at(i).target.func, new_clauses.at(i).target.func);
+
+				for(size_t j = 0; j < new_clauses.at(i).target.args.size(); j++) {
+					if(new_clauses.at(i).target.args.at(j) != nullptr) std::swap(n->clauses.at(i).target.args.at(j), new_clauses.at(i).target.args.at(j));
+				}
+
+				if(new_clauses.at(i).stmt != nullptr) std::swap(n->clauses.at(i).stmt, new_clauses.at(i).stmt);
+				if(new_clauses.at(i).cond != nullptr) std::swap(n->clauses.at(i).cond, new_clauses.at(i).cond);
+			}
 			node = n;
 		}
@@ -969,7 +1053,7 @@
 		if(node->field) { \
 			auto nval = call_accept( node->field ); \
-			if(nval != node->field ) { \
+			if(nval.differs ) { \
 				auto nparent = __pass::mutate<core_t>(node); \
-				nparent->field = nval; \
+				nparent->field = nval.value; \
 				node = nparent; \
 			} \
Index: src/AST/Stmt.cpp
===================================================================
--- src/AST/Stmt.cpp	(revision 21a99ccc1c184c5bca78dca70582d46fc6488bc3)
+++ src/AST/Stmt.cpp	(revision a554e5f423752296e46ab9ced5a34d32676e55d5)
@@ -9,7 +9,7 @@
 // Author           : Aaron B. Moss
 // Created On       : Wed May  8 13:00:00 2019
-// Last Modified By : Andrew Beach
-// Last Modified On : Wed May 15 15:53:00 2019
-// Update Count     : 2
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Wed Feb  2 19:01:20 2022
+// Update Count     : 3
 //
 
@@ -56,6 +56,6 @@
 
 // --- BranchStmt
-BranchStmt::BranchStmt( const CodeLocation& loc, Kind kind, Label target, std::vector<Label>&& labels )
-: Stmt(loc, std::move(labels)), originalTarget(target), target(target), kind(kind) {
+BranchStmt::BranchStmt( const CodeLocation& loc, Kind kind, Label target, const std::vector<Label>&& labels )
+		: Stmt(loc, std::move(labels)), originalTarget(target), target(target), kind(kind) {
 	// Make sure a syntax error hasn't slipped through.
 	assert( Goto != kind || !target.empty() );
Index: src/AST/Stmt.hpp
===================================================================
--- src/AST/Stmt.hpp	(revision 21a99ccc1c184c5bca78dca70582d46fc6488bc3)
+++ src/AST/Stmt.hpp	(revision a554e5f423752296e46ab9ced5a34d32676e55d5)
@@ -10,6 +10,6 @@
 // Created On       : Wed May  8 13:00:00 2019
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Tue Feb  1 17:44:46 2022
-// Update Count     : 24
+// Last Modified On : Wed Feb  2 20:06:41 2022
+// Update Count     : 34
 //
 
@@ -39,5 +39,5 @@
 	std::vector<Label> labels;
 
-	Stmt( const CodeLocation & loc, std::vector<Label> && labels = {} )
+	Stmt( const CodeLocation & loc, const std::vector<Label> && labels = {} )
 		: ParseNode(loc), labels(std::move(labels)) {}
 
@@ -55,6 +55,5 @@
 	std::list<ptr<Stmt>> kids;
 
-	CompoundStmt(const CodeLocation & loc, std::list<ptr<Stmt>> && ks = {},
-				 std::vector<Label> && labels = {} )
+	CompoundStmt(const CodeLocation & loc, const std::list<ptr<Stmt>> && ks = {}, const std::vector<Label> && labels = {} )
 		: Stmt(loc, std::move(labels)), kids(std::move(ks)) {}
 
@@ -74,5 +73,5 @@
 class NullStmt final : public Stmt {
   public:
-	NullStmt( const CodeLocation & loc, std::vector<Label> && labels = {} )
+	NullStmt( const CodeLocation & loc, const std::vector<Label> && labels = {} )
 		: Stmt(loc, std::move(labels)) {}
 
@@ -88,5 +87,5 @@
 	ptr<Expr> expr;
 
-	ExprStmt( const CodeLocation & loc, const Expr* e, std::vector<Label> && labels = {} )
+	ExprStmt( const CodeLocation & loc, const Expr* e, const std::vector<Label> && labels = {} )
 		: Stmt(loc, std::move(labels)), expr(e) {}
 
@@ -107,7 +106,7 @@
 
 	AsmStmt( const CodeLocation & loc, bool isVolatile, const Expr * instruction,
-			 std::vector<ptr<Expr>> && output, std::vector<ptr<Expr>> && input,
-			 std::vector<ptr<ConstantExpr>> && clobber, std::vector<Label> && gotoLabels,
-			 std::vector<Label> && labels = {})
+			 const std::vector<ptr<Expr>> && output, const std::vector<ptr<Expr>> && input,
+			 const std::vector<ptr<ConstantExpr>> && clobber, const std::vector<Label> && gotoLabels,
+			 const std::vector<Label> && labels = {})
 		: Stmt(loc, std::move(labels)), isVolatile(isVolatile), instruction(instruction),
 		  output(std::move(output)), input(std::move(input)), clobber(std::move(clobber)),
@@ -144,6 +143,6 @@
 
 	IfStmt( const CodeLocation & loc, const Expr * cond, const Stmt * then,
-			const Stmt * else_ = nullptr, std::vector<ptr<Stmt>> && inits = {},
-			std::vector<Label> && labels = {} )
+			const Stmt * else_ = nullptr, const std::vector<ptr<Stmt>> && inits = {},
+			const std::vector<Label> && labels = {} )
 		: Stmt(loc, std::move(labels)), cond(cond), then(then), else_(else_),
 		  inits(std::move(inits)) {}
@@ -161,6 +160,6 @@
 	std::vector<ptr<Stmt>> stmts;
 
-	SwitchStmt( const CodeLocation & loc, const Expr * cond, std::vector<ptr<Stmt>> && stmts,
-				std::vector<Label> && labels = {} )
+	SwitchStmt( const CodeLocation & loc, const Expr * cond, const std::vector<ptr<Stmt>> && stmts,
+				const std::vector<Label> && labels = {} )
 		: Stmt(loc, std::move(labels)), cond(cond), stmts(std::move(stmts)) {}
 
@@ -178,6 +177,6 @@
 	std::vector<ptr<Stmt>> stmts;
 
-	CaseStmt( const CodeLocation & loc, const Expr * cond, std::vector<ptr<Stmt>> && stmts,
-			  std::vector<Label> && labels = {} )
+	CaseStmt( const CodeLocation & loc, const Expr * cond, const std::vector<ptr<Stmt>> && stmts,
+			  const std::vector<Label> && labels = {} )
 		: Stmt(loc, std::move(labels)), cond(cond), stmts(std::move(stmts)) {}
 
@@ -200,9 +199,9 @@
 
 	WhileDoStmt( const CodeLocation & loc, const Expr * cond, const Stmt * body,
-			   std::vector<ptr<Stmt>> && inits, bool isDoWhile = false, std::vector<Label> && labels = {} )
+				 const std::vector<ptr<Stmt>> && inits, bool isDoWhile = false, const std::vector<Label> && labels = {} )
 		: Stmt(loc, std::move(labels)), cond(cond), body(body), else_(nullptr), inits(std::move(inits)), isDoWhile(isDoWhile) {}
 
 	WhileDoStmt( const CodeLocation & loc, const Expr * cond, const Stmt * body, const Stmt * else_,
-			   std::vector<ptr<Stmt>> && inits, bool isDoWhile = false, std::vector<Label> && labels = {} )
+				 const std::vector<ptr<Stmt>> && inits, bool isDoWhile = false, const std::vector<Label> && labels = {} )
 		: Stmt(loc, std::move(labels)), cond(cond), body(body), else_(else_), inits(std::move(inits)), isDoWhile(isDoWhile) {}
 
@@ -222,10 +221,10 @@
 	ptr<Stmt> else_;
 
-	ForStmt( const CodeLocation & loc, std::vector<ptr<Stmt>> && inits, const Expr * cond,
-			 const Expr * inc, const Stmt * body, std::vector<Label> && label = {} )
+	ForStmt( const CodeLocation & loc, const std::vector<ptr<Stmt>> && inits, const Expr * cond,
+			 const Expr * inc, const Stmt * body, const std::vector<Label> && label = {} )
 		: Stmt(loc, std::move(label)), inits(std::move(inits)), cond(cond), inc(inc), body(body), else_(nullptr) {}
 
-	ForStmt( const CodeLocation & loc, std::vector<ptr<Stmt>> && inits, const Expr * cond,
-			 const Expr * inc, const Stmt * body, const Stmt * else_, std::vector<Label> && labels = {} )
+	ForStmt( const CodeLocation & loc, const std::vector<ptr<Stmt>> && inits, const Expr * cond,
+			 const Expr * inc, const Stmt * body, const Stmt * else_, const std::vector<Label> && labels = {} )
 		: Stmt(loc, std::move(labels)), inits(std::move(inits)), cond(cond), inc(inc), body(body), else_(else_) {}
 
@@ -247,10 +246,7 @@
 	Kind kind;
 
-	BranchStmt( const CodeLocation & loc, Kind kind, Label target,
-				std::vector<Label> && labels = {} );
-	BranchStmt( const CodeLocation & loc, const Expr * computedTarget,
-				std::vector<Label> && labels = {} )
-		: Stmt(loc, std::move(labels)), originalTarget(loc), target(loc),
-		  computedTarget(computedTarget), kind(Goto) {}
+	BranchStmt( const CodeLocation & loc, Kind kind, Label target, const std::vector<Label> && labels = {} );
+	BranchStmt( const CodeLocation & loc, const Expr * computedTarget, const std::vector<Label> && labels = {} )
+		: Stmt(loc, std::move(labels)), originalTarget(loc), target(loc), computedTarget(computedTarget), kind(Goto) {}
 
 	const char * kindName() const { return kindNames[kind]; }
@@ -269,5 +265,5 @@
 	ptr<Expr> expr;
 
-	ReturnStmt( const CodeLocation & loc, const Expr * expr, std::vector<Label> && labels = {} )
+	ReturnStmt( const CodeLocation & loc, const Expr * expr, const std::vector<Label> && labels = {} )
 		: Stmt(loc, std::move(labels)), expr(expr) {}
 
@@ -288,7 +284,6 @@
 	ExceptionKind kind;
 
-	ThrowStmt(
-		const CodeLocation & loc, ExceptionKind kind, const Expr * expr, const Expr * target,
-		std::vector<Label> && labels = {} )
+	ThrowStmt( const CodeLocation & loc, ExceptionKind kind, const Expr * expr,
+			   const Expr * target, const std::vector<Label> && labels = {} )
 		: Stmt(loc, std::move(labels)), expr(expr), target(target), kind(kind) {}
 
@@ -306,8 +301,7 @@
 	ptr<FinallyStmt> finally;
 
-	TryStmt(
-		const CodeLocation & loc, const CompoundStmt * body,
-		std::vector<ptr<CatchStmt>> && handlers, const FinallyStmt * finally,
-		std::vector<Label> && labels = {} )
+	TryStmt( const CodeLocation & loc, const CompoundStmt * body,
+			 const std::vector<ptr<CatchStmt>> && handlers, const FinallyStmt * finally,
+			 const std::vector<Label> && labels = {} )
 		: Stmt(loc, std::move(labels)), body(body), handlers(std::move(handlers)), finally(finally) {}
 
@@ -326,7 +320,6 @@
 	ExceptionKind kind;
 
-	CatchStmt(
-		const CodeLocation & loc, ExceptionKind kind, const Decl * decl, const Expr * cond,
-		const Stmt * body, std::vector<Label> && labels = {} )
+	CatchStmt( const CodeLocation & loc, ExceptionKind kind, const Decl * decl, const Expr * cond,
+			   const Stmt * body, const std::vector<Label> && labels = {} )
 		: Stmt(loc, std::move(labels)), decl(decl), cond(cond), body(body), kind(kind) {}
 
@@ -358,5 +351,5 @@
 	enum Type { None, Coroutine, Generator } type = None;
 
-	SuspendStmt( const CodeLocation & loc, const CompoundStmt * then, Type type, std::vector<Label> && labels = {} )
+	SuspendStmt( const CodeLocation & loc, const CompoundStmt * then, Type type, const std::vector<Label> && labels = {} )
 		: Stmt(loc, std::move(labels)), then(then), type(type) {}
 
@@ -396,5 +389,5 @@
 	OrElse orElse;
 
-	WaitForStmt( const CodeLocation & loc, std::vector<Label> && labels = {} )
+	WaitForStmt( const CodeLocation & loc, const std::vector<Label> && labels = {} )
 		: Stmt(loc, std::move(labels)) {}
 
@@ -410,5 +403,5 @@
 	ptr<Decl> decl;
 
-	DeclStmt( const CodeLocation & loc, const Decl * decl, std::vector<Label> && labels = {} )
+	DeclStmt( const CodeLocation & loc, const Decl * decl, const std::vector<Label> && labels = {} )
 		: Stmt(loc, std::move(labels)), decl(decl) {}
 
@@ -441,5 +434,5 @@
 
 	MutexStmt( const CodeLocation & loc, const Stmt * stmt, 
-			   std::vector<ptr<Expr>> && mutexes, std::vector<Label> && labels = {} )
+			   const std::vector<ptr<Expr>> && mutexes, const std::vector<Label> && labels = {} )
 		: Stmt(loc, std::move(labels)), stmt(stmt), mutexObjs(std::move(mutexes)) {}
 
Index: src/CodeGen/CodeGenerator.cc
===================================================================
--- src/CodeGen/CodeGenerator.cc	(revision 21a99ccc1c184c5bca78dca70582d46fc6488bc3)
+++ src/CodeGen/CodeGenerator.cc	(revision a554e5f423752296e46ab9ced5a34d32676e55d5)
@@ -10,6 +10,6 @@
 // Created On       : Mon May 18 07:44:20 2015
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Tue Feb  1 16:29:25 2022
-// Update Count     : 540
+// Last Modified On : Wed Feb  2 20:30:30 2022
+// Update Count     : 541
 //
 #include "CodeGenerator.h"
@@ -1020,4 +1020,5 @@
 			output << "fallthru";
 			break;
+		  default: ;									// prevent warning
 		} // switch
 		// print branch target for labelled break/continue/fallthru in debug mode
Index: src/Common/CodeLocation.h
===================================================================
--- src/Common/CodeLocation.h	(revision 21a99ccc1c184c5bca78dca70582d46fc6488bc3)
+++ src/Common/CodeLocation.h	(revision a554e5f423752296e46ab9ced5a34d32676e55d5)
@@ -26,4 +26,5 @@
 	CodeLocation() = default;
 
+
 	/// Create a new CodeLocation with the given values.
 	CodeLocation( const char* filename, int lineno )
@@ -33,4 +34,7 @@
 
 	CodeLocation( const CodeLocation& rhs ) = default;
+	CodeLocation( CodeLocation&& rhs ) = default;
+	CodeLocation& operator=( const CodeLocation & ) = default;
+	CodeLocation& operator=( CodeLocation && ) = default;
 
 	bool isSet () const {
Index: src/Common/utility.h
===================================================================
--- src/Common/utility.h	(revision 21a99ccc1c184c5bca78dca70582d46fc6488bc3)
+++ src/Common/utility.h	(revision a554e5f423752296e46ab9ced5a34d32676e55d5)
@@ -371,4 +371,62 @@
 }
 
+template< typename T >
+struct enumerate_t {
+	template<typename val_t>
+	struct value_t {
+		val_t & val;
+		size_t idx;
+	};
+
+	template< typename iter_t, typename val_t >
+	struct iterator_t {
+		iter_t it;
+		size_t idx;
+
+		iterator_t( iter_t _it, size_t _idx ) : it(_it), idx(_idx) {}
+
+		value_t<val_t> operator*() const { return value_t<val_t>{ *it, idx }; }
+
+		bool operator==(const iterator_t & o) const { return o.it == it; }
+		bool operator!=(const iterator_t & o) const { return o.it != it; }
+
+		iterator_t & operator++() {
+			it++;
+			idx++;
+			return *this;
+		}
+
+		using difference_type   = typename std::iterator_traits< iter_t >::difference_type;
+		using value_type        = value_t<val_t>;
+		using pointer           = value_t<val_t> *;
+		using reference         = value_t<val_t> &;
+		using iterator_category = std::forward_iterator_tag;
+	};
+
+	T & ref;
+
+	using iterator = iterator_t< typename T::iterator, typename T::value_type >;
+	using const_iterator = iterator_t< typename T::const_iterator, const typename T::value_type >;
+
+	iterator begin() { return iterator( ref.begin(), 0 ); }
+	iterator end()   { return iterator( ref.end(), ref.size() ); }
+
+	const_iterator begin() const { return const_iterator( ref.cbegin(), 0 ); }
+	const_iterator end()   const { return const_iterator( ref.cend(), ref.size() ); }
+
+	const_iterator cbegin() const { return const_iterator( ref.cbegin(), 0 ); }
+	const_iterator cend()   const { return const_iterator( ref.cend(), ref.size() ); }
+};
+
+template< typename T >
+enumerate_t<T> enumerate( T & ref ) {
+	return enumerate_t< T >{ ref };
+}
+
+template< typename T >
+const enumerate_t< const T > enumerate( const T & ref ) {
+	return enumerate_t< const T >{ ref };
+}
+
 template< typename OutType, typename Range, typename Functor >
 OutType map_range( const Range& range, Functor&& functor ) {
Index: src/ControlStruct/ExceptTranslate.h
===================================================================
--- src/ControlStruct/ExceptTranslate.h	(revision 21a99ccc1c184c5bca78dca70582d46fc6488bc3)
+++ src/ControlStruct/ExceptTranslate.h	(revision a554e5f423752296e46ab9ced5a34d32676e55d5)
@@ -31,4 +31,5 @@
 
 	void translateTries( std::list< Declaration *> & translationUnit );
+	void translateTries( ast::TranslationUnit & transUnit );
 	/* Replaces all try blocks (and their many clauses) with function definitions and calls.
 	 * This uses the exception built-ins to produce typed output and should take place after
Index: src/ControlStruct/ExceptTranslateNew.cpp
===================================================================
--- src/ControlStruct/ExceptTranslateNew.cpp	(revision 21a99ccc1c184c5bca78dca70582d46fc6488bc3)
+++ src/ControlStruct/ExceptTranslateNew.cpp	(revision a554e5f423752296e46ab9ced5a34d32676e55d5)
@@ -20,6 +20,28 @@
 #include "AST/Stmt.hpp"
 #include "AST/TranslationUnit.hpp"
+#include "AST/DeclReplacer.hpp"
 
 namespace ControlStruct {
+
+namespace {
+
+	typedef std::list<ast::CatchStmt*> CatchList;
+
+	void split( CatchList& allHandlers, CatchList& terHandlers,
+				CatchList& resHandlers ) {
+		while ( !allHandlers.empty() ) {
+			ast::CatchStmt * stmt = allHandlers.front();
+			allHandlers.pop_front();
+			if (stmt->kind == ast::ExceptionKind::Terminate) {
+				terHandlers.push_back(stmt);
+			} else {
+				resHandlers.push_back(stmt);
+			}
+		}
+	}
+
+	void appendDeclStmt( ast::CompoundStmt * block, ast::DeclWithType * item ) {
+		block->push_back(new ast::DeclStmt(block->location, item));
+	}
 
 class TranslateThrowsCore : public ast::WithGuards {
@@ -126,6 +148,609 @@
 }
 
+
+class TryMutatorCore {
+	// The built in types used in translation.
+	const ast::StructDecl * except_decl;
+	const ast::StructDecl * node_decl;
+	const ast::StructDecl * hook_decl;
+
+	// The many helper functions for code/syntree generation.
+	ast::CompoundStmt * take_try_block( ast::TryStmt * tryStmt );
+	ast::FunctionDecl * create_try_wrapper( const ast::CompoundStmt * body );
+	ast::FunctionDecl * create_terminate_catch( CatchList &handlers );
+	ast::CompoundStmt * create_single_matcher(
+		const ast::DeclWithType * except_obj, ast::CatchStmt * modded_handler );
+	ast::FunctionDecl * create_terminate_match( CatchList &handlers );
+	ast::CompoundStmt * create_terminate_caller( CodeLocation loc, ast::FunctionDecl * try_wrapper,
+		ast::FunctionDecl * terminate_catch, ast::FunctionDecl * terminate_match );
+	ast::FunctionDecl * create_resume_handler( CatchList &handlers );
+	ast::CompoundStmt * create_resume_wrapper(
+		const ast::Stmt * wraps, const ast::FunctionDecl * resume_handler );
+	ast::FunctionDecl * create_finally_wrapper( ast::TryStmt * tryStmt );
+	ast::ObjectDecl * create_finally_hook( ast::FunctionDecl * finally_wrapper );
+	ast::Stmt * create_resume_rethrow( const ast::ThrowStmt * throwStmt );
+
+	// Types used in translation, make sure to use clone.
+	// void (*function)();
+	ast::FunctionDecl * try_func_t;
+	// void (*function)(int, exception);
+	ast::FunctionDecl * catch_func_t;
+	// int (*function)(exception);
+	ast::FunctionDecl * match_func_t;
+	// bool (*function)(exception);
+	ast::FunctionDecl * handle_func_t;
+	// void (*function)(__attribute__((unused)) void *);
+	ast::FunctionDecl * finally_func_t;
+
+	ast::StructInstType * create_except_type() {
+		assert( except_decl );
+		return new ast::StructInstType( except_decl );
+	}
+	void init_func_types();
+
+public:
+	TryMutatorCore() :
+		except_decl( nullptr ), node_decl( nullptr ), hook_decl( nullptr )
+	{}
+
+	void previsit( const ast::StructDecl *structDecl );
+	ast::Stmt * postvisit( const ast::TryStmt *tryStmt );
+	ast::Stmt * postvisit( const ast::ThrowStmt *throwStmt );
+};
+
+void TryMutatorCore::init_func_types() {
+	assert( except_decl );
+
+	ast::ObjectDecl index_obj(
+		{},
+		"__handler_index",
+		new ast::BasicType(ast::BasicType::SignedInt)
+		);
+	ast::ObjectDecl exception_obj(
+		{},
+		"__exception_inst",
+		new ast::PointerType(
+			new ast::StructInstType( except_decl )
+			),
+		NULL
+		);
+	ast::ObjectDecl bool_obj(
+		{},
+		"__ret_bool",
+		new ast::BasicType( ast::BasicType::Bool ),
+		nullptr, //init
+		ast::Storage::Classes{},
+		ast::Linkage::Cforall,
+		nullptr, //width
+		std::vector<ast::ptr<ast::Attribute>>{ new ast::Attribute( "unused" ) }
+		);
+	ast::ObjectDecl voidptr_obj(
+		{},
+		"__hook",
+		new ast::PointerType(
+			new ast::VoidType()
+		),
+		nullptr, //init
+		ast::Storage::Classes{},
+		ast::Linkage::Cforall,
+		nullptr, //width
+		std::vector<ast::ptr<ast::Attribute>>{ new ast::Attribute( "unused" ) }
+		);
+
+	ast::ObjectDecl unused_index_obj(
+		{},
+		"__handler_index",
+		new ast::BasicType(ast::BasicType::SignedInt),
+		nullptr,
+		ast::Storage::Classes{},
+		ast::Linkage::Cforall,
+		nullptr, //width
+		std::vector<ast::ptr<ast::Attribute>>{ new ast::Attribute( "unused" ) }
+	);
+	//unused_index_obj->attributes.push_back( new Attribute( "unused" ) );
+
+	try_func_t = new ast::FunctionDecl(
+		{},
+		"try",
+		{}, //forall
+		{}, //no param
+		{}, //no return
+		nullptr,
+		ast::Storage::Classes{},
+		ast::Linkage::Cforall
+	);
+
+	catch_func_t = new ast::FunctionDecl(
+		{},
+		"catch",
+		{}, //forall
+		{ast::deepCopy(&index_obj), ast::deepCopy(&exception_obj)},//param
+		{}, //return void
+		nullptr,
+		ast::Storage::Classes{},
+		ast::Linkage::Cforall
+	);
+
+	match_func_t = new ast::FunctionDecl(
+		{},
+		"match",
+		{}, //forall
+		{ast::deepCopy(&exception_obj)},
+		{ast::deepCopy(&unused_index_obj)},
+		nullptr,
+		ast::Storage::Classes{},
+		ast::Linkage::Cforall
+	);
+
+	handle_func_t = new ast::FunctionDecl(
+		{},
+		"handle",
+		{}, //forall
+		{ast::deepCopy(&exception_obj)},
+		{ast::deepCopy(&bool_obj)},
+		nullptr,
+		ast::Storage::Classes{},
+		ast::Linkage::Cforall
+	);
+
+	finally_func_t = new ast::FunctionDecl(
+		{},
+		"finally",
+		{}, //forall
+		{ast::deepCopy(&voidptr_obj)},
+		{}, //return void
+		nullptr,
+		ast::Storage::Classes{},
+		ast::Linkage::Cforall
+	);
+
+	//catch_func_t.get_parameters().push_back( index_obj.clone() );
+	//catch_func_t.get_parameters().push_back( exception_obj.clone() );
+	//match_func_t.get_returnVals().push_back( unused_index_obj );
+	//match_func_t.get_parameters().push_back( exception_obj.clone() );
+	//handle_func_t.get_returnVals().push_back( bool_obj.clone() );
+	//handle_func_t.get_parameters().push_back( exception_obj.clone() );
+	//finally_func_t.get_parameters().push_back( voidptr_obj.clone() );
+}
+
+// TryStmt Mutation Helpers
+
+/*
+ast::CompoundStmt * TryMutatorCore::take_try_block( ast::TryStmt *tryStmt ) {
+	ast::CompoundStmt * block = tryStmt->body;
+	tryStmt->body = nullptr;
+	return block;
+}
+*/
+
+ast::FunctionDecl * TryMutatorCore::create_try_wrapper(
+		const ast::CompoundStmt *body ) {
+
+	ast::FunctionDecl * ret = ast::deepCopy(try_func_t);
+	ret->stmts = body;
+	return ret;
+}
+
+ast::FunctionDecl * TryMutatorCore::create_terminate_catch(
+		CatchList &handlers ) {
+	std::vector<ast::ptr<ast::Stmt>> handler_wrappers;
+
+	assert (!handlers.empty());
+	const CodeLocation loc = handlers.front()->location;
+
+	ast::FunctionDecl * func_t = ast::deepCopy(catch_func_t);
+	const ast::DeclWithType * index_obj = func_t->params.front();
+	const ast::DeclWithType * except_obj = func_t->params.back();
+
+	// Index 1..{number of handlers}
+	int index = 0;
+	CatchList::iterator it = handlers.begin();
+	for ( ; it != handlers.end() ; ++it ) {
+		++index;
+		ast::CatchStmt * handler = *it;
+		const CodeLocation loc = handler->location;
+
+		// case `index`:
+		// {
+		//     `handler.decl` = { (virtual `decl.type`)`except` };
+		//     `handler.body`;
+		// }
+		// return;
+		ast::CompoundStmt * block = new ast::CompoundStmt(loc);
+
+		// Just copy the exception value. (Post Validation)
+		const ast::ObjectDecl * handler_decl =
+			handler->decl.strict_as<ast::ObjectDecl>();
+		ast::ObjectDecl * local_except = ast::deepCopy(handler_decl);
+		ast::VirtualCastExpr * vcex = new ast::VirtualCastExpr(loc,
+			new ast::VariableExpr( loc, except_obj ),
+			local_except->get_type()
+			);
+		vcex->location = handler->location;
+		local_except->init = new ast::ListInit(loc, { new ast::SingleInit( loc, vcex ) });
+		block->push_back( new ast::DeclStmt( loc, local_except ) );
+
+		// Add the cleanup attribute.
+		local_except->attributes.push_back( new ast::Attribute(
+			"cleanup",
+			{ new ast::NameExpr( loc, "__cfaehm_cleanup_terminate" ) }
+			) );
+
+		ast::DeclReplacer::DeclMap mapping;
+		mapping[handler_decl] = local_except;
+		const ast::Stmt * mutBody = strict_dynamic_cast<const ast::Stmt *>(
+			ast::DeclReplacer::replace(handler->body, mapping));
+
+
+		block->push_back( mutBody );
+		// handler->body = nullptr;
+
+		handler_wrappers.push_back( new ast::CaseStmt(loc, 
+			ast::ConstantExpr::from_int(loc, index) ,
+			{ block, new ast::ReturnStmt( loc, nullptr ) }
+			));
+	}
+	// TODO: Some sort of meaningful error on default perhaps?
+
+	/*
+	std::list<Statement*> stmt_handlers;
+	while ( !handler_wrappers.empty() ) {
+		stmt_handlers.push_back( handler_wrappers.front() );
+		handler_wrappers.pop_front();
+	}
+	*/
+
+	ast::SwitchStmt * handler_lookup = new ast::SwitchStmt(loc, 
+		new ast::VariableExpr( loc, index_obj ),
+		std::move(handler_wrappers)
+		);
+	ast::CompoundStmt * body = new ast::CompoundStmt(loc, 
+		{handler_lookup});
+
+	func_t->stmts = body;
+	return func_t;
+}
+
+// Create a single check from a moddified handler.
+// except_obj is referenced, modded_handler will be freed.
+ast::CompoundStmt * TryMutatorCore::create_single_matcher(
+		const ast::DeclWithType * except_obj, ast::CatchStmt * modded_handler ) {
+	// {
+	//     `modded_handler.decl`
+	//     if ( `decl.name = (virtual `decl.type`)`except`
+	//             [&& `modded_handler.cond`] ) {
+	//         `modded_handler.body`
+	//     }
+	// }
+
+	const CodeLocation loc = modded_handler->location;
+	ast::CompoundStmt * block = new ast::CompoundStmt(loc);
+
+	// Local Declaration
+	const ast::ObjectDecl * local_except =
+		modded_handler->decl.strict_as<ast::ObjectDecl>();
+	block->push_back( new ast::DeclStmt( loc,  local_except ) );
+
+	// Check for type match.
+	ast::VirtualCastExpr * vcex = new ast::VirtualCastExpr(loc, 
+		new ast::VariableExpr(loc, except_obj ),
+		local_except->get_type()
+		);
+	ast::Expr * cond = ast::UntypedExpr::createAssign(loc,
+		new ast::VariableExpr(loc, local_except ), vcex );
+
+	// Add the check on the conditional if it is provided.
+	if ( modded_handler->cond ) {
+		cond = new ast::LogicalExpr( loc, cond, modded_handler->cond, ast::LogicalFlag::AndExpr );
+	}
+	// Construct the match condition.
+	block->push_back( new ast::IfStmt(loc, 
+		cond, modded_handler->body, nullptr ) );
+
+	// xxx - how does this work in new ast
+	//modded_handler->set_decl( nullptr );
+	//modded_handler->set_cond( nullptr );
+	//modded_handler->set_body( nullptr );
+	//delete modded_handler;
+	return block;
+}
+
+ast::FunctionDecl * TryMutatorCore::create_terminate_match(
+		CatchList &handlers ) {
+	// int match(exception * except) {
+	//     HANDLER WRAPPERS { return `index`; }
+	// }
+
+	assert (!handlers.empty());
+	const CodeLocation loc = handlers.front()->location;
+
+	ast::CompoundStmt * body = new ast::CompoundStmt(loc);
+
+	ast::FunctionDecl * func_t = ast::deepCopy(match_func_t);
+	const ast::DeclWithType * except_obj = func_t->params.back();
+
+	// Index 1..{number of handlers}
+	int index = 0;
+	CatchList::iterator it;
+	for ( it = handlers.begin() ; it != handlers.end() ; ++it ) {
+		++index;
+		ast::CatchStmt * handler = *it;
+
+		// Body should have been taken by create_terminate_catch.
+		// xxx - just ignore it?
+		// assert( nullptr == handler->get_body() );
+
+		// Create new body.
+		handler->body = new ast::ReturnStmt( handler->location,
+			ast::ConstantExpr::from_int( handler->location, index ) );
+
+		// Create the handler.
+		body->push_back( create_single_matcher( except_obj, handler ) );
+		*it = nullptr;
+	}
+
+	body->push_back( new ast::ReturnStmt(loc, 
+		ast::ConstantExpr::from_int( loc, 0 ) ));
+
+	func_t->stmts = body;
+
+	return func_t;
+}
+
+ast::CompoundStmt * TryMutatorCore::create_terminate_caller(
+		CodeLocation loc,
+		ast::FunctionDecl * try_wrapper,
+		ast::FunctionDecl * terminate_catch,
+		ast::FunctionDecl * terminate_match ) {
+	// { __cfaehm_try_terminate(`try`, `catch`, `match`); }
+
+	ast::UntypedExpr * caller = new ast::UntypedExpr(loc, new ast::NameExpr(loc,
+		"__cfaehm_try_terminate" ) );
+	caller->args.push_back( new ast::VariableExpr(loc, try_wrapper ) );
+	caller->args.push_back( new ast::VariableExpr(loc, terminate_catch ) );
+	caller->args.push_back( new ast::VariableExpr(loc, terminate_match ) );
+
+	ast::CompoundStmt * callStmt = new ast::CompoundStmt(loc);
+	callStmt->push_back( new ast::ExprStmt( loc, caller ) );
+	return callStmt;
+}
+
+ast::FunctionDecl * TryMutatorCore::create_resume_handler(
+		CatchList &handlers ) {
+	// bool handle(exception * except) {
+	//     HANDLER WRAPPERS { `hander->body`; return true; }
+	// }
+	assert (!handlers.empty());
+	const CodeLocation loc = handlers.front()->location;
+	ast::CompoundStmt * body = new ast::CompoundStmt(loc);
+
+	ast::FunctionDecl * func_t = ast::deepCopy(handle_func_t);
+	const ast::DeclWithType * except_obj = func_t->params.back();
+
+	CatchList::iterator it;
+	for ( it = handlers.begin() ; it != handlers.end() ; ++it ) {
+		ast::CatchStmt * handler = *it;
+		const CodeLocation loc = handler->location;
+		// Modifiy body.
+		ast::CompoundStmt * handling_code;
+		if (handler->body.as<ast::CompoundStmt>()) {
+			handling_code = 
+			strict_dynamic_cast<ast::CompoundStmt*>( handler->body.get_and_mutate() );
+		} else {
+			handling_code = new ast::CompoundStmt(loc);
+			handling_code->push_back( handler->body );
+		}
+		handling_code->push_back( new ast::ReturnStmt(loc,
+			ast::ConstantExpr::from_bool(loc, true ) ) );
+		handler->body = handling_code;
+
+		// Create the handler.
+		body->push_back( create_single_matcher( except_obj, handler ) );
+		*it = nullptr;
+	}
+
+	body->push_back( new ast::ReturnStmt(loc,
+		ast::ConstantExpr::from_bool(loc, false ) ) );
+	func_t->stmts = body;
+
+	return func_t;
+}
+
+ast::CompoundStmt * TryMutatorCore::create_resume_wrapper(
+		const ast::Stmt * wraps,
+		const ast::FunctionDecl * resume_handler ) {
+	const CodeLocation loc = wraps->location;
+	ast::CompoundStmt * body = new ast::CompoundStmt(loc);
+
+	// struct __try_resume_node __resume_node
+	//  	__attribute__((cleanup( __cfaehm_try_resume_cleanup )));
+	// ** unwinding of the stack here could cause problems **
+	// ** however I don't think that can happen currently **
+	// __cfaehm_try_resume_setup( &__resume_node, resume_handler );
+
+	ast::ObjectDecl * obj = new ast::ObjectDecl(
+		loc,
+		"__resume_node",
+		new ast::StructInstType(
+			node_decl
+			),
+		nullptr,
+		ast::Storage::Classes{},
+		ast::Linkage::Cforall,
+		nullptr,
+		{new ast::Attribute("cleanup", {new ast::NameExpr(loc, "__cfaehm_try_resume_cleanup")})}
+		);
+	appendDeclStmt( body, obj );
+
+	ast::UntypedExpr *setup = new ast::UntypedExpr(loc, new ast::NameExpr(loc,
+		"__cfaehm_try_resume_setup" ) );
+	setup->args.push_back( new ast::AddressExpr( loc, new ast::VariableExpr(loc, obj ) ) );
+	setup->args.push_back( new ast::VariableExpr( loc, resume_handler ) );
+
+	body->push_back( new ast::ExprStmt(loc, setup ) );
+
+	body->push_back( wraps );
+	return body;
+}
+
+ast::FunctionDecl * TryMutatorCore::create_finally_wrapper(
+		ast::TryStmt * tryStmt ) {
+	// void finally() { `finally->block` }
+	const ast::FinallyStmt * finally = tryStmt->finally;
+	const ast::CompoundStmt * body = finally->body;
+
+	ast::FunctionDecl * func_t = ast::deepCopy(finally_func_t);
+	func_t->stmts = body;
+
+	// finally->set_block( nullptr );
+	// delete finally;
+	tryStmt->finally = nullptr;
+
+
+	return func_t;
+}
+
+ast::ObjectDecl * TryMutatorCore::create_finally_hook(
+		ast::FunctionDecl * finally_wrapper ) {
+	// struct __cfaehm_cleanup_hook __finally_hook
+	//   	__attribute__((cleanup( `finally_wrapper` )));
+
+	const CodeLocation loc = finally_wrapper->location;
+	// Make Cleanup Attribute.
+	/*
+	std::list< ast::Attribute * > attributes;
+	{
+		std::list<  > attr_params;
+		attr_params.push_back( nameOf( finally_wrapper ) );
+		attributes.push_back( new Attribute( "cleanup", attr_params ) );
+	}
+	*/
+
+	return new ast::ObjectDecl(
+		loc,
+		"__finally_hook",
+		new ast::StructInstType(
+			hook_decl
+			),
+		nullptr,
+		ast::Storage::Classes{},
+		ast::Linkage::Cforall,
+		nullptr,
+		{new ast::Attribute("cleanup", {new ast::VariableExpr{loc, finally_wrapper}})}
+		);
+}
+
+ast::Stmt * TryMutatorCore::create_resume_rethrow( const ast::ThrowStmt *throwStmt ) {
+	// return false;
+	const CodeLocation loc = throwStmt->location;
+	ast::Stmt * result = new ast::ReturnStmt(loc, 
+		ast::ConstantExpr::from_bool( loc, false )
+		);
+	result->labels = throwStmt->labels;
+	// delete throwStmt; done by postvisit
+	return result;
+}
+
+// Visiting/Mutating Functions
+void TryMutatorCore::previsit( const ast::StructDecl *structDecl ) {
+	if ( !structDecl->body ) {
+		// Skip children?
+		return;
+	} else if ( structDecl->name == "__cfaehm_base_exception_t" ) {
+		assert( nullptr == except_decl );
+		except_decl = structDecl;
+		init_func_types();
+	} else if ( structDecl->name == "__cfaehm_try_resume_node" ) {
+		assert( nullptr == node_decl );
+		node_decl = structDecl;
+	} else if ( structDecl->name == "__cfaehm_cleanup_hook" ) {
+		assert( nullptr == hook_decl );
+		hook_decl = structDecl;
+	}
+}
+
+ast::Stmt * TryMutatorCore::postvisit( const ast::TryStmt *tryStmt ) {
+	assert( except_decl );
+	assert( node_decl );
+	assert( hook_decl );
+
+	const CodeLocation loc = tryStmt->location;
+	ast::TryStmt * mutStmt = mutate(tryStmt);
+	// Generate a prefix for the function names?
+
+	ast::CompoundStmt * block = new ast::CompoundStmt( loc );
+	// ast::CompoundStmt * inner = take_try_block( mutStmt );
+	// this is never mutated so let node deletion do its job?
+	const ast::CompoundStmt * inner = mutStmt->body;
+
+	if ( mutStmt->finally ) {
+		// Define the helper function.
+		ast::FunctionDecl * finally_block =
+			create_finally_wrapper( mutStmt );
+		appendDeclStmt( block, finally_block );
+		// Create and add the finally cleanup hook.
+		appendDeclStmt( block, create_finally_hook( finally_block ) );
+	}
+
+	CatchList termination_handlers;
+	CatchList resumption_handlers;
+
+	for (auto & handler: mutStmt->handlers) {
+		// xxx - should always be unique? mutate as safe const-cast
+		assert(handler->unique());
+		if (handler->kind == ast::ExceptionKind::Resume) {
+			resumption_handlers.push_back(handler.get_and_mutate());
+		}
+		else {
+			termination_handlers.push_back(handler.get_and_mutate());
+		}
+	}
+	// split( mutStmt->handlers,
+	//		termination_handlers, resumption_handlers );
+
+	if ( resumption_handlers.size() ) {
+		// Define the helper function.
+		ast::FunctionDecl * resume_handler =
+			create_resume_handler( resumption_handlers );
+		appendDeclStmt( block, resume_handler );
+		// Prepare hooks
+		inner = create_resume_wrapper( inner, resume_handler );
+	}
+
+	if ( termination_handlers.size() ) {
+		// Define the three helper functions.
+		ast::FunctionDecl * try_wrapper = create_try_wrapper( inner );
+		appendDeclStmt( block, try_wrapper );
+		ast::FunctionDecl * terminate_catch =
+			create_terminate_catch( termination_handlers );
+		appendDeclStmt( block, terminate_catch );
+		ast::FunctionDecl * terminate_match =
+			create_terminate_match( termination_handlers );
+		appendDeclStmt( block, terminate_match );
+		// Build the call to the try wrapper.
+		inner = create_terminate_caller(inner->location,
+			try_wrapper, terminate_catch, terminate_match );
+	}
+
+	// Embed the try block.
+	block->push_back( inner );
+
+	return block;
+}
+
+ast::Stmt * TryMutatorCore::postvisit( const ast::ThrowStmt *throwStmt ) {
+	// Only valid `throwResume;` statements should remain. (2/3 checks)
+	assert( ast::ExceptionKind::Resume == throwStmt->kind && ! throwStmt->expr );
+	return create_resume_rethrow( throwStmt );
+}
+
+} // namespace
+
 void translateThrows( ast::TranslationUnit & transUnit ) {
 	ast::Pass<TranslateThrowsCore>::run( transUnit );
+}
+
+void translateTries( ast::TranslationUnit & transUnit ) {
+	ast::Pass<TryMutatorCore>::run(transUnit);
 }
 
Index: src/ControlStruct/MLEMutator.cc
===================================================================
--- src/ControlStruct/MLEMutator.cc	(revision 21a99ccc1c184c5bca78dca70582d46fc6488bc3)
+++ src/ControlStruct/MLEMutator.cc	(revision a554e5f423752296e46ab9ced5a34d32676e55d5)
@@ -10,6 +10,6 @@
 // Created On       : Mon May 18 07:44:20 2015
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Tue Feb  1 09:26:28 2022
-// Update Count     : 225
+// Last Modified On : Wed Feb  2 20:18:57 2022
+// Update Count     : 227
 //
 
@@ -136,5 +136,5 @@
 			}
 		}
-		assertf( false, "Could not find label '%s' on statement %s",
+		assertf( false, "CFA internal error: could not find label '%s' on statement %s",
 			originalTarget.get_name().c_str(), toString( stmt ).c_str() );
 	}
@@ -395,5 +395,7 @@
 		}
 		assert( ! enclosingControlStructures.empty() );
-		assertf( dynamic_cast<SwitchStmt *>( enclosingControlStructures.back().get_controlStructure() ), "Control structure enclosing a case clause must be a switch, but is: %s", toCString( enclosingControlStructures.back().get_controlStructure() ) );
+		assertf( dynamic_cast<SwitchStmt *>( enclosingControlStructures.back().get_controlStructure() ),
+				 "CFA internal error: control structure enclosing a case clause must be a switch, but is: %s",
+				 toCString( enclosingControlStructures.back().get_controlStructure() ) );
 		if ( caseStmt->isDefault() ) {
 			if ( enclosingControlStructures.back().isFallDefaultUsed() ) {
Index: src/ControlStruct/MultiLevelExit.cpp
===================================================================
--- src/ControlStruct/MultiLevelExit.cpp	(revision 21a99ccc1c184c5bca78dca70582d46fc6488bc3)
+++ src/ControlStruct/MultiLevelExit.cpp	(revision a554e5f423752296e46ab9ced5a34d32676e55d5)
@@ -10,6 +10,6 @@
 // Created On       : Mon Nov  1 13:48:00 2021
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Tue Feb  1 18:48:47 2022
-// Update Count     : 29
+// Last Modified On : Wed Feb  2 23:07:54 2022
+// Update Count     : 33
 //
 
@@ -49,5 +49,4 @@
 		return target.label;
 	}
-
   public:
 	Entry( const ForStmt * stmt, Label breakExit, Label contExit ) :
@@ -168,5 +167,5 @@
 
 	// if the stmt is labelled then generate a label to check in postvisit if the label is used
-	bool isLabeled = !stmt->labels.empty();
+	bool isLabeled = ! stmt->labels.empty();
 	if ( isLabeled ) {
 		Label breakLabel = newLabel( "blockBreak", stmt );
@@ -180,7 +179,7 @@
 
 	if ( isLabeled ) {
-		assert( !enclosing_control_structures.empty() );
+		assert( ! enclosing_control_structures.empty() );
 		Entry & entry = enclosing_control_structures.back();
-		if ( !entry.useBreakExit().empty() ) {
+		if ( ! entry.useBreakExit().empty() ) {
 			break_label = entry.useBreakExit();
 		}
@@ -206,5 +205,5 @@
 		}
 	}
-	assertf( false, "Could not find label '%s' on statement %s",
+	assertf( false, "CFA internal error: could not find label '%s' on statement %s",
 			 originalTarget.name.c_str(), toString( stmt ).c_str() );
 }
@@ -254,5 +253,5 @@
 		  }
 		  // Ensure that selected target is valid.
-		  if ( targetEntry == enclosing_control_structures.rend() || ( isContinue && !isContinueTarget( *targetEntry ) ) ) {
+		  if ( targetEntry == enclosing_control_structures.rend() || ( isContinue && ! isContinueTarget( *targetEntry ) ) ) {
 			  SemanticError( stmt->location, toString( (isContinue ? "'continue'" : "'break'"),
 							" target must be an enclosing ", (isContinue ? "loop: " : "control structure: "),
@@ -268,12 +267,11 @@
 			  SemanticError( stmt->location, "'fallthrough' must be enclosed in a 'switch' or 'choose'" );
 		  }
-		  if ( !stmt->target.empty() ) {
+		  if ( ! stmt->target.empty() ) {
 			  // Labelled fallthrough: target must be a valid fallthough label.
-			  if ( !fallthrough_labels.count( stmt->target ) ) {
+			  if ( ! fallthrough_labels.count( stmt->target ) ) {
 				  SemanticError( stmt->location, toString( "'fallthrough' target must be a later case statement: ",
 														   stmt->originalTarget ) );
 			  }
-			  return new BranchStmt(
-				  stmt->location, BranchStmt::Goto, stmt->originalTarget );
+			  return new BranchStmt( stmt->location, BranchStmt::Goto, stmt->originalTarget );
 		  }
 		  break;
@@ -307,25 +305,24 @@
 	}
 
-	// Branch error checks: get the appropriate label name:
-	// (This label is always replaced.)
+	// Branch error checks: get the appropriate label name, which is always replaced.
 	Label exitLabel( CodeLocation(), "" );
 	switch ( stmt->kind ) {
 	  case BranchStmt::Break:
-		assert( !targetEntry->useBreakExit().empty() );
+		assert( ! targetEntry->useBreakExit().empty() );
 		exitLabel = targetEntry->useBreakExit();
 		break;
 	  case BranchStmt::Continue:
-		assert( !targetEntry->useContExit().empty() );
+		assert( ! targetEntry->useContExit().empty() );
 		exitLabel = targetEntry->useContExit();
 		break;
 	  case BranchStmt::FallThrough:
-		assert( !targetEntry->useFallExit().empty() );
+		assert( ! targetEntry->useFallExit().empty() );
 		exitLabel = targetEntry->useFallExit();
 		break;
 	  case BranchStmt::FallThroughDefault:
-		assert( !targetEntry->useFallDefaultExit().empty() );
+		assert( ! targetEntry->useFallDefaultExit().empty() );
 		exitLabel = targetEntry->useFallDefaultExit();
 		// Check that fallthrough default comes before the default clause.
-		if ( !targetEntry->isFallDefaultValid() ) {
+		if ( ! targetEntry->isFallDefaultValid() ) {
 			SemanticError( stmt->location, "'fallthrough default' must precede the 'default' clause" );
 		}
@@ -373,5 +370,5 @@
 	// If default, mark seen.
 	if ( stmt->isDefault() ) {
-		assert( !enclosing_control_structures.empty() );
+		assert( ! enclosing_control_structures.empty() );
 		enclosing_control_structures.back().seenDefault();
 	}
@@ -399,6 +396,5 @@
 		Entry & entry = enclosing_control_structures.back();
 		if ( entry.isFallUsed() ) {
-			mutStmt->stmts.push_back(
-				labelledNullStmt( mutStmt->location, entry.useFallExit() ) );
+			mutStmt->stmts.push_back( labelledNullStmt( mutStmt->location, entry.useFallExit() ) );
 		}
 	}
@@ -406,12 +402,10 @@
 	Entry & entry = enclosing_control_structures.back();
 	assertf( dynamic_cast< const SwitchStmt * >( entry.stmt ),
-			 "Control structure enclosing a case clause must be a switch, but is: %s",
+			 "CFA internal error: control structure enclosing a case clause must be a switch, but is: %s",
 			 toString( entry.stmt ).c_str() );
 	if ( mutStmt->isDefault() ) {
 		if ( entry.isFallDefaultUsed() ) {
 			// Add fallthrough default label if necessary.
-			push_front( mutStmt->stmts, labelledNullStmt(
-							stmt->location, entry.useFallDefaultExit()
-							) );
+			push_front( mutStmt->stmts, labelledNullStmt( stmt->location, entry.useFallDefaultExit() ) );
 		}
 	}
@@ -420,5 +414,5 @@
 
 void MultiLevelExitCore::previsit( const IfStmt * stmt ) {
-	bool labeledBlock = !stmt->labels.empty();
+	bool labeledBlock = ! stmt->labels.empty();
 	if ( labeledBlock ) {
 		Label breakLabel = newLabel( "blockBreak", stmt );
@@ -429,8 +423,8 @@
 
 const IfStmt * MultiLevelExitCore::postvisit( const IfStmt * stmt ) {
-	bool labeledBlock = !stmt->labels.empty();
+	bool labeledBlock = ! stmt->labels.empty();
 	if ( labeledBlock ) {
 		auto this_label = enclosing_control_structures.back().useBreakExit();
-		if ( !this_label.empty() ) {
+		if ( ! this_label.empty() ) {
 			break_label = this_label;
 		}
@@ -448,14 +442,11 @@
 	auto it = find_if( stmt->stmts.rbegin(), stmt->stmts.rend(), isDefaultCase );
 
-	const CaseStmt * defaultCase = it != stmt->stmts.rend()
-		? (it)->strict_as<CaseStmt>() : nullptr;
-	Label defaultLabel = defaultCase
-		? newLabel( "fallThroughDefault", defaultCase )
-		: Label( stmt->location, "" );
+	const CaseStmt * defaultCase = it != stmt->stmts.rend() ? (it)->strict_as<CaseStmt>() : nullptr;
+	Label defaultLabel = defaultCase ? newLabel( "fallThroughDefault", defaultCase ) : Label( stmt->location, "" );
 	enclosing_control_structures.emplace_back( stmt, label, defaultLabel );
 	GuardAction( [this]() { enclosing_control_structures.pop_back(); } );
 
-	// Collect valid labels for fallthrough. It starts with all labels at
-	// this level, then remove as each is seen during traversal.
+	// Collect valid labels for fallthrough. It starts with all labels at this level, then remove as each is seen during
+	// traversal.
 	for ( const Stmt * stmt : stmt->stmts ) {
 		auto * caseStmt = strict_dynamic_cast< const CaseStmt * >( stmt );
@@ -471,5 +462,5 @@
 
 const SwitchStmt * MultiLevelExitCore::postvisit( const SwitchStmt * stmt ) {
-	assert( !enclosing_control_structures.empty() );
+	assert( ! enclosing_control_structures.empty() );
 	Entry & entry = enclosing_control_structures.back();
 	assert( entry.stmt == stmt );
@@ -477,11 +468,9 @@
 	// Only run to generate the break label.
 	if ( entry.isBreakUsed() ) {
-		// To keep the switch statements uniform (all direct children of a
-		// SwitchStmt should be CastStmts), append the exit label and break
-		// to the last case, create a default case is there are no cases.
+		// To keep the switch statements uniform (all direct children of a SwitchStmt should be CastStmts), append the
+		// exit label and break to the last case, create a default case if no cases.
 		SwitchStmt * mutStmt = mutate( stmt );
 		if ( mutStmt->stmts.empty() ) {
-			mutStmt->stmts.push_back( new CaseStmt(
-										  mutStmt->location, nullptr, {} ));
+			mutStmt->stmts.push_back( new CaseStmt( mutStmt->location, nullptr, {} ) );
 		}
 
@@ -507,5 +496,5 @@
 
 void MultiLevelExitCore::previsit( const TryStmt * stmt ) {
-	bool isLabeled = !stmt->labels.empty();
+	bool isLabeled = ! stmt->labels.empty();
 	if ( isLabeled ) {
 		Label breakLabel = newLabel( "blockBreak", stmt );
@@ -516,8 +505,8 @@
 
 void MultiLevelExitCore::postvisit( const TryStmt * stmt ) {
-	bool isLabeled = !stmt->labels.empty();
+	bool isLabeled = ! stmt->labels.empty();
 	if ( isLabeled ) {
 		auto this_label = enclosing_control_structures.back().useBreakExit();
-		if ( !this_label.empty() ) {
+		if ( ! this_label.empty() ) {
 			break_label = this_label;
 		}
@@ -526,7 +515,5 @@
 
 void MultiLevelExitCore::previsit( const FinallyStmt * ) {
-	GuardAction([this, old = move(enclosing_control_structures)](){
-					enclosing_control_structures = move(old);
-				});
+	GuardAction([this, old = move( enclosing_control_structures)](){ enclosing_control_structures = move(old); });
 	enclosing_control_structures = vector<Entry>();
 	GuardValue( inFinally ) = true;
@@ -575,11 +562,10 @@
 template<typename LoopNode>
 const LoopNode * MultiLevelExitCore::posthandleLoopStmt( const LoopNode * loopStmt ) {
-	assert( !enclosing_control_structures.empty() );
+	assert( ! enclosing_control_structures.empty() );
 	Entry & entry = enclosing_control_structures.back();
 	assert( entry.stmt == loopStmt );
 
 	// Now check if the labels are used and add them if so.
-	return mutate_field(
-		loopStmt, &LoopNode::body, mutateLoop( loopStmt->body, entry ) );
+	return mutate_field( loopStmt, &LoopNode::body, mutateLoop( loopStmt->body, entry ) );
 	// this call to mutate_field compares loopStmt->body and the result of mutateLoop
 	// 		if they are the same the node isn't mutated, if they differ then the new mutated node is returned
@@ -609,12 +595,11 @@
 		}
 
-		if ( !break_label.empty() ) {
-			ret.push_back(
-				labelledNullStmt( ret.back()->location, break_label ) );
+		if ( ! break_label.empty() ) {
+			ret.push_back( labelledNullStmt( ret.back()->location, break_label ) );
 			break_label = Label( CodeLocation(), "" );
 		}
 	}
 
-	if ( !errors.isEmpty() ) {
+	if ( ! errors.isEmpty() ) {
 		throw errors;
 	}
Index: src/Parser/StatementNode.cc
===================================================================
--- src/Parser/StatementNode.cc	(revision 21a99ccc1c184c5bca78dca70582d46fc6488bc3)
+++ src/Parser/StatementNode.cc	(revision a554e5f423752296e46ab9ced5a34d32676e55d5)
@@ -11,6 +11,6 @@
 // Created On       : Sat May 16 14:59:41 2015
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Wed Feb  2 12:27:58 2022
-// Update Count     : 424
+// Last Modified On : Wed Feb  2 20:29:30 2022
+// Update Count     : 425
 //
 
@@ -138,9 +138,9 @@
 
 Statement * build_case( ExpressionNode * ctl ) {
-	return new CaseStmt( maybeMoveBuild< Expression >(ctl), {} ); // no init
+	return new CaseStmt( maybeMoveBuild< Expression >(ctl), {} ); // stmt starts empty and then added to
 } // build_case
 
 Statement * build_default() {
-	return new CaseStmt( nullptr, {}, true );			// no init
+	return new CaseStmt( nullptr, {}, true );			// stmt starts empty and then added to
 } // build_default
 
Index: src/SynTree/Statement.cc
===================================================================
--- src/SynTree/Statement.cc	(revision 21a99ccc1c184c5bca78dca70582d46fc6488bc3)
+++ src/SynTree/Statement.cc	(revision a554e5f423752296e46ab9ced5a34d32676e55d5)
@@ -10,6 +10,6 @@
 // Created On       : Mon May 18 07:44:20 2015
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Wed Feb  2 11:55:19 2022
-// Update Count     : 80
+// Last Modified On : Wed Feb  2 20:19:33 2022
+// Update Count     : 90
 //
 
@@ -29,10 +29,10 @@
 #include "SynTree/Label.h"         // for Label, operator<<
 
-using std::string;
-using std::endl;
-
-Statement::Statement( const std::list<Label> & labels ) : labels( labels ) {}
-
-void Statement::print( std::ostream & os, Indenter indent ) const {
+using namespace std;
+
+
+Statement::Statement( const list<Label> & labels ) : labels( labels ) {}
+
+void Statement::print( ostream & os, Indenter indent ) const {
 	if ( ! labels.empty() ) {
 		os << indent << "... Labels: {";
@@ -54,11 +54,11 @@
 }
 
-void ExprStmt::print( std::ostream & os, Indenter indent ) const {
-	os << "Expression Statement:" << endl << indent+1;
-	expr->print( os, indent+1 );
-}
-
-
-AsmStmt::AsmStmt( bool voltile, Expression * instruction, std::list<Expression *> output, std::list<Expression *> input, std::list<ConstantExpr *> clobber, std::list<Label> gotolabels ) : Statement(), voltile( voltile ), instruction( instruction ), output( output ), input( input ), clobber( clobber ), gotolabels( gotolabels ) {}
+void ExprStmt::print( ostream & os, Indenter indent ) const {
+	os << "Expression Statement:" << endl << indent + 1;
+	expr->print( os, indent + 1 );
+}
+
+
+AsmStmt::AsmStmt( bool voltile, Expression * instruction, const list<Expression *> output, const list<Expression *> input, const list<ConstantExpr *> clobber, const list<Label> gotolabels ) : Statement(), voltile( voltile ), instruction( instruction ), output( output ), input( input ), clobber( clobber ), gotolabels( gotolabels ) {}
 
 AsmStmt::AsmStmt( const AsmStmt & other ) : Statement( other ), voltile( other.voltile ), instruction( maybeClone( other.instruction ) ), gotolabels( other.gotolabels ) {
@@ -75,26 +75,26 @@
 }
 
-void AsmStmt::print( std::ostream & os, Indenter indent ) const {
+void AsmStmt::print( ostream & os, Indenter indent ) const {
 	os << "Assembler Statement:" << endl;
-	os << indent+1 << "instruction: " << endl << indent;
-	instruction->print( os, indent+1 );
+	os << indent + 1 << "instruction: " << endl << indent;
+	instruction->print( os, indent + 1 );
 	if ( ! output.empty() ) {
-		os << endl << indent+1 << "output: " << endl;
-		printAll( output, os, indent+1 );
+		os << endl << indent + 1 << "output: " << endl;
+		printAll( output, os, indent + 1 );
 	} // if
 	if ( ! input.empty() ) {
-		os << indent+1 << "input: " << endl;
-		printAll( input, os, indent+1 );
+		os << indent + 1 << "input: " << endl;
+		printAll( input, os, indent + 1 );
 	} // if
 	if ( ! clobber.empty() ) {
-		os << indent+1 << "clobber: " << endl;
-		printAll( clobber, os, indent+1 );
+		os << indent + 1 << "clobber: " << endl;
+		printAll( clobber, os, indent + 1 );
 	} // if
 }
 
 
-DirectiveStmt::DirectiveStmt( const std::string & directive ) : Statement(), directive( directive ) {}
-
-void DirectiveStmt::print( std::ostream & os, Indenter ) const {
+DirectiveStmt::DirectiveStmt( const string & directive ) : Statement(), directive( directive ) {}
+
+void DirectiveStmt::print( ostream & os, Indenter ) const {
 	os << "GCC Directive:" << directive << endl;
 }
@@ -120,10 +120,10 @@
 }
 
-void BranchStmt::print( std::ostream & os, Indenter indent ) const {
-	assert(type < 5);
+void BranchStmt::print( ostream & os, Indenter indent ) const {
+	assertf(type < BranchStmts, "CFA internal error: invalid branch statement" );
 	os << "Branch (" << brType[type] << ")" << endl ;
-	if ( target != "" ) os << indent+1 << "with target: " << target << endl;
-	if ( originalTarget != "" ) os << indent+1 << "with original target: " << originalTarget << endl;
-	if ( computedTarget != nullptr ) os << indent+1 << "with computed target: " << computedTarget << endl;
+	if ( target != "" ) os << indent + 1 << "with target: " << target << endl;
+	if ( originalTarget != "" ) os << indent + 1 << "with original target: " << originalTarget << endl;
+	if ( computedTarget != nullptr ) os << indent + 1 << "with computed target: " << computedTarget << endl;
 }
 
@@ -136,14 +136,14 @@
 }
 
-void ReturnStmt::print( std::ostream & os, Indenter indent ) const {
+void ReturnStmt::print( ostream & os, Indenter indent ) const {
 	os << "Return Statement, returning: ";
 	if ( expr != nullptr ) {
-		os << endl << indent+1;
-		expr->print( os, indent+1 );
+		os << endl << indent + 1;
+		expr->print( os, indent + 1 );
 	}
 	os << endl;
 }
 
-IfStmt::IfStmt( Expression * condition, Statement * then, Statement * else_, std::list<Statement *> initialization ):
+IfStmt::IfStmt( Expression * condition, Statement * then, Statement * else_, const list<Statement *> initialization ):
 	Statement(), condition( condition ), then( then ), else_( else_ ), initialization( initialization ) {}
 
@@ -160,14 +160,14 @@
 }
 
-void IfStmt::print( std::ostream & os, Indenter indent ) const {
+void IfStmt::print( ostream & os, Indenter indent ) const {
 	os << "If on condition: " << endl;
-	os << indent+1;
-	condition->print( os, indent+1 );
+	os << indent + 1;
+	condition->print( os, indent + 1 );
 
 	if ( !initialization.empty() ) {
 		os << indent << "... with initialization: \n";
 		for ( const Statement * stmt : initialization ) {
-			os << indent+1;
-			stmt->print( os, indent+1 );
+			os << indent + 1;
+			stmt->print( os, indent + 1 );
 		}
 		os << endl;
@@ -176,15 +176,15 @@
 	os << indent << "... then: " << endl;
 
-	os << indent+1;
-	then->print( os, indent+1 );
+	os << indent + 1;
+	then->print( os, indent + 1 );
 
 	if ( else_ != nullptr ) {
 		os << indent << "... else: " << endl;
-		os << indent+1;
-		else_->print( os, indent+1 );
+		os << indent + 1;
+		else_->print( os, indent + 1 );
 	} // if
 }
 
-SwitchStmt::SwitchStmt( Expression * condition, const std::list<Statement *> & statements ):
+SwitchStmt::SwitchStmt( Expression * condition, const list<Statement *> & statements ):
 	Statement(), condition( condition ), statements( statements ) {
 }
@@ -201,5 +201,5 @@
 }
 
-void SwitchStmt::print( std::ostream & os, Indenter indent ) const {
+void SwitchStmt::print( ostream & os, Indenter indent ) const {
 	os << "Switch on condition: ";
 	condition->print( os );
@@ -207,15 +207,15 @@
 
 	for ( const Statement * stmt : statements ) {
-		stmt->print( os, indent+1 );
-	}
-}
-
-CaseStmt::CaseStmt( Expression * condition, const std::list<Statement *> & statements, bool deflt ) throw ( SemanticErrorException ) :
-	Statement(), condition( condition ), stmts( statements ), _isDefault( deflt ) {
+		stmt->print( os, indent + 1 );
+	}
+}
+
+CaseStmt::CaseStmt( Expression * condition, const list<Statement *> & statements, bool deflt ) throw ( SemanticErrorException ) :
+		Statement(), condition( condition ), stmts( statements ), _isDefault( deflt ) {
 	if ( isDefault() && condition != nullptr ) SemanticError( condition, "default case with condition: " );
 }
 
 CaseStmt::CaseStmt( const CaseStmt & other ) :
-	Statement( other ), condition( maybeClone(other.condition ) ), _isDefault( other._isDefault ) {
+		Statement( other ), condition( maybeClone(other.condition ) ), _isDefault( other._isDefault ) {
 	cloneAll( other.stmts, stmts );
 }
@@ -226,5 +226,5 @@
 }
 
-CaseStmt * CaseStmt::makeDefault( const std::list<Label> & labels, std::list<Statement *> stmts ) {
+CaseStmt * CaseStmt::makeDefault( const list<Label> & labels, list<Statement *> stmts ) {
 	CaseStmt * stmt = new CaseStmt( nullptr, stmts, true );
 	stmt->labels = labels;
@@ -232,5 +232,5 @@
 }
 
-void CaseStmt::print( std::ostream & os, Indenter indent ) const {
+void CaseStmt::print( ostream & os, Indenter indent ) const {
 	if ( isDefault() ) os << indent << "Default ";
 	else {
@@ -241,14 +241,14 @@
 
 	for ( Statement * stmt : stmts ) {
-		os << indent+1;
-		stmt->print( os, indent+1 );
-	}
-}
-
-WhileDoStmt::WhileDoStmt( Expression * condition, Statement * body, const std::list< Statement * > & initialization, bool isDoWhile ):
+		os << indent + 1;
+		stmt->print( os, indent + 1 );
+	}
+}
+
+WhileDoStmt::WhileDoStmt( Expression * condition, Statement * body, const list< Statement * > & initialization, bool isDoWhile ):
 	Statement(), condition( condition ), body( body ), else_( nullptr ), initialization( initialization ), isDoWhile( isDoWhile) {
 }
 
-WhileDoStmt::WhileDoStmt( Expression * condition, Statement * body, Statement * else_, const std::list< Statement * > & initialization, bool isDoWhile ):
+WhileDoStmt::WhileDoStmt( Expression * condition, Statement * body, Statement * else_, const list< Statement * > & initialization, bool isDoWhile ):
 	Statement(), condition( condition), body( body ), else_( else_ ), initialization( initialization ), isDoWhile( isDoWhile) {
 }
@@ -263,14 +263,14 @@
 }
 
-void WhileDoStmt::print( std::ostream & os, Indenter indent ) const {
+void WhileDoStmt::print( ostream & os, Indenter indent ) const {
 	os << "While on condition: " << endl ;
-	condition->print( os, indent+1 );
+	condition->print( os, indent + 1 );
 
 	os << indent << "... with body: " << endl;
 
-	if ( body != nullptr ) body->print( os, indent+1 );
-}
-
-ForStmt::ForStmt( std::list<Statement *> initialization, Expression * condition, Expression * increment, Statement * body, Statement * else_ ):
+	if ( body != nullptr ) body->print( os, indent + 1 );
+}
+
+ForStmt::ForStmt( const list<Statement *> initialization, Expression * condition, Expression * increment, Statement * body, Statement * else_ ):
 	Statement(), initialization( initialization ), condition( condition ), increment( increment ), body( body ), else_( else_ ) {
 }
@@ -290,5 +290,5 @@
 }
 
-void ForStmt::print( std::ostream & os, Indenter indent ) const {
+void ForStmt::print( ostream & os, Indenter indent ) const {
 	Statement::print( os, indent ); // print labels
 
@@ -298,27 +298,27 @@
 		os << indent << "... initialization: \n";
 		for ( Statement * stmt : initialization ) {
-			os << indent+1;
-			stmt->print( os, indent+1 );
+			os << indent + 1;
+			stmt->print( os, indent + 1 );
 		}
 	}
 
 	if ( condition != nullptr ) {
-		os << indent << "... condition: \n" << indent+1;
-		condition->print( os, indent+1 );
+		os << indent << "... condition: \n" << indent + 1;
+		condition->print( os, indent + 1 );
 	}
 
 	if ( increment != nullptr ) {
-		os << "\n" << indent << "... increment: \n" << indent+1;
-		increment->print( os, indent+1 );
+		os << "\n" << indent << "... increment: \n" << indent + 1;
+		increment->print( os, indent + 1 );
 	}
 
 	if ( body != nullptr ) {
-		os << "\n" << indent << "... with body: \n" << indent+1;
-		body->print( os, indent+1 );
+		os << "\n" << indent << "... with body: \n" << indent + 1;
+		body->print( os, indent + 1 );
 	}
 
 	if ( else_ != nullptr ) {
-		os << "\n" << indent << "... with body: \n" << indent+1;
-		else_->print( os, indent+1 );
+		os << "\n" << indent << "... with body: \n" << indent + 1;
+		else_->print( os, indent + 1 );
 	}
 	os << endl;
@@ -339,15 +339,15 @@
 }
 
-void ThrowStmt::print( std::ostream & os, Indenter indent) const {
+void ThrowStmt::print( ostream & os, Indenter indent) const {
 	if ( target ) os << "Non-Local ";
 	os << "Throw Statement, raising: ";
-	expr->print(os, indent+1);
+	expr->print(os, indent + 1);
 	if ( target ) {
 		os << "... at: ";
-		target->print(os, indent+1);
-	}
-}
-
-TryStmt::TryStmt( CompoundStmt * tryBlock, std::list<CatchStmt *> & handlers, FinallyStmt * finallyBlock ) :
+		target->print(os, indent + 1);
+	}
+}
+
+TryStmt::TryStmt( CompoundStmt * tryBlock, const list<CatchStmt *> & handlers, FinallyStmt * finallyBlock ) :
 	Statement(), block( tryBlock ),  handlers( handlers ), finallyBlock( finallyBlock ) {
 }
@@ -363,20 +363,20 @@
 }
 
-void TryStmt::print( std::ostream & os, Indenter indent ) const {
+void TryStmt::print( ostream & os, Indenter indent ) const {
 	os << "Try Statement" << endl;
-	os << indent << "... with block:" << endl << indent+1;
-	block->print( os, indent+1 );
+	os << indent << "... with block:" << endl << indent + 1;
+	block->print( os, indent + 1 );
 
 	// handlers
 	os << indent << "... and handlers:" << endl;
 	for ( const CatchStmt * stmt : handlers ) {
-		os << indent+1;
-		stmt->print( os, indent+1 );
+		os << indent + 1;
+		stmt->print( os, indent + 1 );
 	}
 
 	// finally block
 	if ( finallyBlock != nullptr ) {
-		os << indent << "... and finally:" << endl << indent+1;
-		finallyBlock->print( os, indent+1 );
+		os << indent << "... and finally:" << endl << indent + 1;
+		finallyBlock->print( os, indent + 1 );
 	} // if
 }
@@ -396,19 +396,19 @@
 }
 
-void CatchStmt::print( std::ostream & os, Indenter indent ) const {
+void CatchStmt::print( ostream & os, Indenter indent ) const {
 	os << "Catch " << ((Terminate == kind) ? "Terminate" : "Resume") << " Statement" << endl;
 
 	os << indent << "... catching: ";
-	decl->printShort( os, indent+1 );
+	decl->printShort( os, indent + 1 );
 	os << endl;
 
 	if ( cond ) {
-		os << indent << "... with conditional:" << endl << indent+1;
-		cond->print( os, indent+1 );
+		os << indent << "... with conditional:" << endl << indent + 1;
+		cond->print( os, indent + 1 );
 	}
 
 	os << indent << "... with block:" << endl;
-	os << indent+1;
-	body->print( os, indent+1 );
+	os << indent + 1;
+	body->print( os, indent + 1 );
 }
 
@@ -424,8 +424,8 @@
 }
 
-void FinallyStmt::print( std::ostream & os, Indenter indent ) const {
+void FinallyStmt::print( ostream & os, Indenter indent ) const {
 	os << "Finally Statement" << endl;
-	os << indent << "... with block:" << endl << indent+1;
-	block->print( os, indent+1 );
+	os << indent << "... with block:" << endl << indent + 1;
+	block->print( os, indent + 1 );
 }
 
@@ -439,5 +439,5 @@
 }
 
-void SuspendStmt::print( std::ostream & os, Indenter indent ) const {
+void SuspendStmt::print( ostream & os, Indenter indent ) const {
 	os << "Suspend Statement";
 	switch (type) {
@@ -496,5 +496,5 @@
 }
 
-void WaitForStmt::print( std::ostream & os, Indenter indent ) const {
+void WaitForStmt::print( ostream & os, Indenter indent ) const {
 	os << "Waitfor Statement" << endl;
 	indent += 1;
@@ -531,5 +531,5 @@
 
 
-WithStmt::WithStmt( const std::list< Expression * > & exprs, Statement * stmt ) : Declaration("", noStorageClasses, LinkageSpec::Cforall), exprs( exprs ), stmt( stmt ) {}
+WithStmt::WithStmt( const list< Expression * > & exprs, Statement * stmt ) : Declaration("", noStorageClasses, LinkageSpec::Cforall), exprs( exprs ), stmt( stmt ) {}
 WithStmt::WithStmt( const WithStmt & other ) : Declaration( other ), stmt( maybeClone( other.stmt ) ) {
 	cloneAll( other.exprs, exprs );
@@ -540,17 +540,17 @@
 }
 
-void WithStmt::print( std::ostream & os, Indenter indent ) const {
+void WithStmt::print( ostream & os, Indenter indent ) const {
 	os << "With statement" << endl;
 	os << indent << "... with expressions: " << endl;
-	printAll( exprs, os, indent+1 );
-	os << indent << "... with statement:" << endl << indent+1;
-	stmt->print( os, indent+1 );
-}
-
-
-NullStmt::NullStmt( const std::list<Label> & labels ) : Statement( labels ) {
-}
-
-void NullStmt::print( std::ostream & os, Indenter indent ) const {
+	printAll( exprs, os, indent + 1 );
+	os << indent << "... with statement:" << endl << indent + 1;
+	stmt->print( os, indent + 1 );
+}
+
+
+NullStmt::NullStmt( const list<Label> & labels ) : Statement( labels ) {
+}
+
+void NullStmt::print( ostream & os, Indenter indent ) const {
 	os << "Null Statement" << endl;
 	Statement::print( os, indent );
@@ -568,12 +568,12 @@
 }
 
-void ImplicitCtorDtorStmt::print( std::ostream & os, Indenter indent ) const {
+void ImplicitCtorDtorStmt::print( ostream & os, Indenter indent ) const {
 	os << "Implicit Ctor Dtor Statement" << endl;
 	os << indent << "... with Ctor/Dtor: ";
-	callStmt->print( os, indent+1);
+	callStmt->print( os, indent + 1);
 	os << endl;
 }
 
-MutexStmt::MutexStmt( Statement * stmt, std::list<Expression *> mutexObjs ) 
+MutexStmt::MutexStmt( Statement * stmt, const list<Expression *> mutexObjs ) 
 	: Statement(), stmt( stmt ), mutexObjs( mutexObjs ) { }
 
@@ -587,14 +587,14 @@
 }
 
-void MutexStmt::print( std::ostream & os, Indenter indent ) const {
+void MutexStmt::print( ostream & os, Indenter indent ) const {
 	os << "Mutex Statement" << endl;
 	os << indent << "... with Expressions: " << endl;
 	for (auto * obj : mutexObjs) {
-		os << indent+1;
-		obj->print( os, indent+1);
+		os << indent + 1;
+		obj->print( os, indent + 1);
 		os << endl;
 	}
-	os << indent << "... with Statement: " << endl << indent+1;
-	stmt->print( os, indent+1 );
+	os << indent << "... with Statement: " << endl << indent + 1;
+	stmt->print( os, indent + 1 );
 }
 
Index: src/SynTree/Statement.h
===================================================================
--- src/SynTree/Statement.h	(revision 21a99ccc1c184c5bca78dca70582d46fc6488bc3)
+++ src/SynTree/Statement.h	(revision a554e5f423752296e46ab9ced5a34d32676e55d5)
@@ -10,6 +10,6 @@
 // Created On       : Mon May 18 07:44:20 2015
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Wed Feb  2 11:49:17 2022
-// Update Count     : 94
+// Last Modified On : Wed Feb  2 20:15:30 2022
+// Update Count     : 98
 //
 
@@ -107,5 +107,5 @@
 	std::list<Label> gotolabels;
 
-	AsmStmt( bool voltile, Expression * instruction, std::list<Expression *> output, std::list<Expression *> input, std::list<ConstantExpr *> clobber, std::list<Label> gotolabels );
+	AsmStmt( bool voltile, Expression * instruction, const std::list<Expression *> output, const std::list<Expression *> input, const std::list<ConstantExpr *> clobber, const std::list<Label> gotolabels );
 	AsmStmt( const AsmStmt & other );
 	virtual ~AsmStmt();
@@ -153,5 +153,5 @@
 
 	IfStmt( Expression * condition, Statement * then, Statement * else_,
-			std::list<Statement *> initialization = std::list<Statement *>() );
+			const std::list<Statement *> initialization = std::list<Statement *>() );
 	IfStmt( const IfStmt & other );
 	virtual ~IfStmt();
@@ -260,5 +260,5 @@
 	Statement * else_;
 
-	ForStmt( std::list<Statement *> initialization, Expression * condition = nullptr, Expression * increment = nullptr, Statement * body = nullptr, Statement * else_ = nullptr );
+	ForStmt( const std::list<Statement *> initialization, Expression * condition = nullptr, Expression * increment = nullptr, Statement * body = nullptr, Statement * else_ = nullptr );
 	ForStmt( const ForStmt & other );
 	virtual ~ForStmt();
@@ -281,5 +281,5 @@
 class BranchStmt : public Statement {
   public:
-	enum Type { Goto = 0, Break, Continue, FallThrough, FallThroughDefault };
+	enum Type { Goto, Break, Continue, FallThrough, FallThroughDefault, BranchStmts };
 
 	// originalTarget kept for error messages.
@@ -360,5 +360,5 @@
 	FinallyStmt * finallyBlock;
 
-	TryStmt( CompoundStmt * tryBlock, std::list<CatchStmt *> & handlers, FinallyStmt * finallyBlock = nullptr );
+	TryStmt( CompoundStmt * tryBlock, const std::list<CatchStmt *> & handlers, FinallyStmt * finallyBlock = nullptr );
 	TryStmt( const TryStmt & other );
 	virtual ~TryStmt();
@@ -543,5 +543,5 @@
 	std::list<Expression *> mutexObjs; // list of mutex objects to acquire
 
-	MutexStmt( Statement * stmt, std::list<Expression *> mutexObjs );
+	MutexStmt( Statement * stmt, const std::list<Expression *> mutexObjs );
 	MutexStmt( const MutexStmt & other );
 	virtual ~MutexStmt();
Index: src/main.cc
===================================================================
--- src/main.cc	(revision 21a99ccc1c184c5bca78dca70582d46fc6488bc3)
+++ src/main.cc	(revision a554e5f423752296e46ab9ced5a34d32676e55d5)
@@ -415,4 +415,7 @@
 			// Currently not working due to unresolved issues with UniqueExpr
 			PASS( "Expand Unique Expr", Tuples::expandUniqueExpr( transUnit ) ); // xxx - is this the right place for this? want to expand ASAP so tha, sequent passes don't need to worry about double-visiting a unique expr - needs to go after InitTweak::fix so that copy constructed return declarations are reused
+
+			PASS( "Translate Tries" , ControlStruct::translateTries( transUnit ) );
+
 			translationUnit = convert( move( transUnit ) );
 		} else {
@@ -481,7 +484,9 @@
 
 			PASS( "Expand Unique Expr", Tuples::expandUniqueExpr( translationUnit ) ); // xxx - is this the right place for this? want to expand ASAP so tha, sequent passes don't need to worry about double-visiting a unique expr - needs to go after InitTweak::fix so that copy constructed return declarations are reused
+
+			PASS( "Translate Tries" , ControlStruct::translateTries( translationUnit ) );
 		}
 
-		PASS( "Translate Tries" , ControlStruct::translateTries( translationUnit ) );
+		
 
 		PASS( "Gen Waitfor" , Concurrency::generateWaitFor( translationUnit ) );
Index: tests/concurrent/.expect/preempt2.txt
===================================================================
--- tests/concurrent/.expect/preempt2.txt	(revision a554e5f423752296e46ab9ced5a34d32676e55d5)
+++ tests/concurrent/.expect/preempt2.txt	(revision a554e5f423752296e46ab9ced5a34d32676e55d5)
@@ -0,0 +1,1 @@
+Done
Index: tests/concurrent/preempt2.cfa
===================================================================
--- tests/concurrent/preempt2.cfa	(revision a554e5f423752296e46ab9ced5a34d32676e55d5)
+++ tests/concurrent/preempt2.cfa	(revision a554e5f423752296e46ab9ced5a34d32676e55d5)
@@ -0,0 +1,50 @@
+#include <fstream.hfa>
+#include <thread.hfa>
+#include <time.hfa>
+
+#include "long_tests.hfa"
+
+#ifndef PREEMPTION_RATE
+#define PREEMPTION_RATE 10`ms
+#endif
+
+Duration default_preemption() {
+	return PREEMPTION_RATE;
+}
+
+#ifdef TEST_LONG
+static const unsigned long N = 30_000ul;
+#else
+static const unsigned long N = 500ul;
+#endif
+
+extern void __cfaabi_check_preemption();
+
+static struct {
+	volatile int x;
+	volatile int y;
+} globals;
+
+thread T1 {};
+void main(T1 &) {
+	for() {
+		if ( globals.x == N ) break;
+		if ( globals.x < globals.y ) globals.x += 1;
+	}
+}
+
+thread T2 {};
+void main(T2 &) {
+	for() {
+		if ( globals.y == N ) break;
+		if ( globals.y == globals.x ) globals.y += 1;
+	}
+}
+
+int main() {
+	{
+		T1 t1;
+		T2 t2;
+	}
+	sout | "Done";
+} // main
Index: tests/include/.expect/includes.nast.txt
===================================================================
--- tests/include/.expect/includes.nast.txt	(revision 21a99ccc1c184c5bca78dca70582d46fc6488bc3)
+++ tests/include/.expect/includes.nast.txt	(revision a554e5f423752296e46ab9ced5a34d32676e55d5)
@@ -1,1 +1,1 @@
-include/includes.cfa:154:25: warning: Compiled
+include/includes.cfa:153:25: warning: Compiled
Index: tests/include/includes.cfa
===================================================================
--- tests/include/includes.cfa	(revision 21a99ccc1c184c5bca78dca70582d46fc6488bc3)
+++ tests/include/includes.cfa	(revision a554e5f423752296e46ab9ced5a34d32676e55d5)
@@ -10,6 +10,6 @@
 // Created On       : Wed May 27 17:56:53 2015
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Sat Jun  5 10:06:46 2021
-// Update Count     : 751
+// Last Modified On : Thu Feb  3 22:06:07 2022
+// Update Count     : 774
 //
 
@@ -18,4 +18,5 @@
 #endif // __CFA__
 
+#if 1
 //#define _GNU_SOURCE
 #include <aio.h>
@@ -40,5 +41,5 @@
 #include <errno.h>
 #include <error.h>
-//#include <eti.h>                                                                              // may not be installed, comes with ncurses
+//#include <eti.h>										// may not be installed, comes with ncurses
 #include <execinfo.h>
 #include <expat.h>
@@ -49,5 +50,5 @@
 #include <fmtmsg.h>
 #include <fnmatch.h>
-//#include <form.h>                                                                             // may not be installed, comes with ncurses
+//#include <form.h>										// may not be installed, comes with ncurses
 #include <fstab.h>
 #include <fts.h>
@@ -77,14 +78,14 @@
 #include <mcheck.h>
 #include <memory.h>
-//#include <menu.h>                                                                             // may not be installed, comes with ncurses
+//#include <menu.h>										// may not be installed, comes with ncurses
 #include <mntent.h>
 #include <monetary.h>
 #include <mqueue.h>
-//#include <ncurses_dll.h>                                                                      // may not be installed, comes with ncurses
+//#include <ncurses_dll.h>								// may not be installed, comes with ncurses
 #include <netdb.h>
 #include <nl_types.h>
 #include <nss.h>
 #include <obstack.h>
-//#include <panel.h>                                                                            // may not be installed, comes with ncurses
+//#include <panel.h>										// may not be installed, comes with ncurses
 #include <paths.h>
 #include <poll.h>
@@ -117,6 +118,6 @@
 #include <syslog.h>
 #include <tar.h>
-//#include <term.h>                                                                             // may not be installed, comes with ncurses
-//#include <termcap.h>                                                                          // may not be installed, comes with ncurses
+//#include <term.h>										// may not be installed, comes with ncurses
+//#include <termcap.h>									// may not be installed, comes with ncurses
 #include <termio.h>
 #include <termios.h>
@@ -130,5 +131,5 @@
 #include <ucontext.h>
 #include <ulimit.h>
-//#include <unctrl.h>                                                                           // may not be installed, comes with ncurses
+//#include <unctrl.h>										// may not be installed, comes with ncurses
 #include <unistd.h>
 #include <utime.h>
@@ -143,6 +144,4 @@
 #include <wctype.h>
 #include <wordexp.h>
-
-#if 0
 #endif // 0
 
@@ -151,6 +150,6 @@
 #endif // __CFA__
 
-int main( int argc, char const *argv[] ) {
-    #pragma GCC warning "Compiled"                      // force non-empty .expect file, NO TABS!!!
+int main( int argc, char const * argv[] ) {
+    #pragma GCC warning "Compiled"							// force non-empty .expect file, NO TABS!!!
 }
 
