Index: tests/Makefile.am
===================================================================
--- tests/Makefile.am	(revision d5b2ac82c5d162b3f54cf7db3bdcbb3a48149204)
+++ tests/Makefile.am	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
@@ -16,4 +16,5 @@
 
 AUTOMAKE_OPTIONS = foreign    # do not require all the GNU file names
+ACLOCAL_AMFLAGS  = -I automake
 
 include $(top_srcdir)/src/cfa.make
@@ -44,7 +45,9 @@
 .PHONY: list .validate
 .INTERMEDIATE: .validate .validate.cfa
-EXTRA_PROGRAMS = avl_test # build but do not install
+EXTRA_PROGRAMS = avl_test .dummy_hack # build but do not install
 
-avl_test_SOURCES = avltree/avl_test.c avltree/avl0.c avltree/avl1.c avltree/avl2.c avltree/avl3.c avltree/avl4.c avltree/avl-private.c
+avl_test_SOURCES = avltree/avl_test.cfa avltree/avl0.cfa avltree/avl1.cfa avltree/avl2.cfa avltree/avl3.cfa avltree/avl4.cfa avltree/avl-private.cfa
+# automake doesn't know we still need C rules so pretend like we have a C program
+_dummy_hack_SOURCES = .dummy_hack.c
 
 #----------------------------------------------------------------------------------------------------------------
@@ -67,5 +70,6 @@
 	@echo "int main() { return 0; }" > ${@}
 
-dummy_hack.c:
+# automake doesn't know we still need C rules so pretend like we have a C program
+.dummy_hack.c:
 	@echo "int main() { return 0; }" > ${@}
 
@@ -76,7 +80,4 @@
 
 # implicit rule so not all test require a rule
-% : %.c $(CFACC)
-	$(PRETTY_PATH) $(CFACOMPILE) $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})
-
 % : %.cfa $(CFACC)
 	$(PRETTY_PATH) $(CFACOMPILE) $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})
@@ -107,5 +108,5 @@
 
 #builtins
-builtins/sync: builtins/sync.c $(CFACC)
+builtins/sync: builtins/sync.cfa $(CFACC)
 	$(PRETTY_PATH) $(CFACOMPILE) $(shell realpath --relative-to=${srcdir} ${<}) 2> $(abspath ${@}) -fsyntax-only
 
@@ -132,17 +133,17 @@
 
 # Constructor/destructor tests
-raii/dtor-early-exit-ERR1: raii/dtor-early-exit.c $(CFACC)
+raii/dtor-early-exit-ERR1: raii/dtor-early-exit.cfa $(CFACC)
 	$(PRETTY_PATH) $(CFACOMPILE) -DERR1 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})
 
-raii/dtor-early-exit-ERR2: raii/dtor-early-exit.c $(CFACC)
+raii/dtor-early-exit-ERR2: raii/dtor-early-exit.cfa $(CFACC)
 	$(PRETTY_PATH) $(CFACOMPILE) -DERR2 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})
 
-raii/memberCtors-ERR1: raii/memberCtors.c $(CFACC)
+raii/memberCtors-ERR1: raii/memberCtors.cfa $(CFACC)
 	$(PRETTY_PATH) $(CFACOMPILE) -DERR1 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})
 
-raii/ctor-autogen-ERR1: raii/ctor-autogen.c $(CFACC)
+raii/ctor-autogen-ERR1: raii/ctor-autogen.cfa $(CFACC)
 	$(PRETTY_PATH) $(CFACOMPILE) -DERR1 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})
 
 # Warnings
-warnings/self-assignment: warnings/self-assignment.c $(CFACC)
+warnings/self-assignment: warnings/self-assignment.cfa $(CFACC)
 	$(PRETTY_PATH) $(CFACOMPILE) $(shell realpath --relative-to=${srcdir} ${<}) 2> $(abspath ${@}) -fsyntax-only
Index: tests/Makefile.in
===================================================================
--- tests/Makefile.in	(revision d5b2ac82c5d162b3f54cf7db3bdcbb3a48149204)
+++ tests/Makefile.in	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
@@ -91,9 +91,13 @@
 build_triplet = @build@
 host_triplet = @host@
-EXTRA_PROGRAMS = avl_test$(EXEEXT)
+EXTRA_PROGRAMS = avl_test$(EXEEXT) .dummy_hack$(EXEEXT)
 subdir = tests
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/automake/cfa.m4 \
-	$(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/automake/libtool.m4 \
+	$(top_srcdir)/automake/ltoptions.m4 \
+	$(top_srcdir)/automake/ltsugar.m4 \
+	$(top_srcdir)/automake/ltversion.m4 \
+	$(top_srcdir)/automake/lt~obsolete.m4 \
+	$(top_srcdir)/automake/cfa.m4 $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
@@ -103,4 +107,11 @@
 CONFIG_CLEAN_FILES = config.py
 CONFIG_CLEAN_VPATH_FILES = test.py
+am__dummy_hack_OBJECTS = .dummy_hack.$(OBJEXT)
+_dummy_hack_OBJECTS = $(am__dummy_hack_OBJECTS)
+_dummy_hack_LDADD = $(LDADD)
+AM_V_lt = $(am__v_lt_@AM_V@)
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
+am__v_lt_0 = --silent
+am__v_lt_1 = 
 am__dirstamp = $(am__leading_dot)dirstamp
 am_avl_test_OBJECTS = avltree/avl_test.$(OBJEXT) \
@@ -128,4 +139,8 @@
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
 	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
+	$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+	$(AM_CFLAGS) $(CFLAGS)
 AM_V_CC = $(am__v_CC_@AM_V@)
 am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
@@ -133,11 +148,13 @@
 am__v_CC_1 = 
 CCLD = $(CC)
-LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(AM_LDFLAGS) $(LDFLAGS) -o $@
 AM_V_CCLD = $(am__v_CCLD_@AM_V@)
 am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
 am__v_CCLD_0 = @echo "  CCLD    " $@;
 am__v_CCLD_1 = 
-SOURCES = $(avl_test_SOURCES)
-DIST_SOURCES = $(avl_test_SOURCES)
+SOURCES = $(_dummy_hack_SOURCES) $(avl_test_SOURCES)
+DIST_SOURCES = $(_dummy_hack_SOURCES) $(avl_test_SOURCES)
 am__can_run_installinfo = \
   case $$AM_UPDATE_INFO_DIR in \
@@ -172,4 +189,5 @@
 AMTAR = @AMTAR@
 AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AR = @AR@
 AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
@@ -195,4 +213,5 @@
 CPPFLAGS = @CPPFLAGS@
 CXX = @CXX@
+CXXCPP = @CXXCPP@
 CXXDEPMODE = @CXXDEPMODE@
 CXXFLAGS = @CXXFLAGS@
@@ -200,5 +219,8 @@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
 DRIVER_DIR = @DRIVER_DIR@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
@@ -206,4 +228,5 @@
 EGREP = @EGREP@
 EXEEXT = @EXEEXT@
+FGREP = @FGREP@
 GREP = @GREP@
 HOST_FLAGS = @HOST_FLAGS@
@@ -213,4 +236,5 @@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
 LDFLAGS = @LDFLAGS@
 LEX = @LEX@
@@ -221,8 +245,18 @@
 LIBOBJS = @LIBOBJS@
 LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
+LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
 MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
 MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
 OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -234,4 +268,5 @@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 RANLIB = @RANLIB@
+SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
@@ -245,6 +280,8 @@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
 am__include = @am__include@
 am__leading_dot = @am__leading_dot@
@@ -294,4 +331,5 @@
 top_srcdir = @top_srcdir@
 AUTOMAKE_OPTIONS = foreign    # do not require all the GNU file names
+ACLOCAL_AMFLAGS = -I automake
 CFACOMPILE = $(CFACC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CFAFLAGS) $(CFAFLAGS) $(AM_CFLAGS) $(CFLAGS)
 LTCFACOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
@@ -329,9 +367,11 @@
 	${INSTALL_FLAGS} ${ARCH_FLAGS}
 PRETTY_PATH = cd ${srcdir} &&
-avl_test_SOURCES = avltree/avl_test.c avltree/avl0.c avltree/avl1.c avltree/avl2.c avltree/avl3.c avltree/avl4.c avltree/avl-private.c
+avl_test_SOURCES = avltree/avl_test.cfa avltree/avl0.cfa avltree/avl1.cfa avltree/avl2.cfa avltree/avl3.cfa avltree/avl4.cfa avltree/avl-private.cfa
+# automake doesn't know we still need C rules so pretend like we have a C program
+_dummy_hack_SOURCES = .dummy_hack.c
 all: all-am
 
 .SUFFIXES:
-.SUFFIXES: .c .cfa .lo .o .obj .validate
+.SUFFIXES: .c .cfa .dummy_hack .lo .o .obj .validate
 $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am $(top_srcdir)/src/cfa.make $(am__configure_deps)
 	@for dep in $?; do \
@@ -366,4 +406,8 @@
 config.py: $(top_builddir)/config.status $(srcdir)/config.py.in
 	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+
+.dummy_hack$(EXEEXT): $(_dummy_hack_OBJECTS) $(_dummy_hack_DEPENDENCIES) $(EXTRA__dummy_hack_DEPENDENCIES) 
+	@rm -f .dummy_hack$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(_dummy_hack_OBJECTS) $(_dummy_hack_LDADD) $(LIBS)
 avltree/$(am__dirstamp):
 	@$(MKDIR_P) avltree
@@ -398,11 +442,5 @@
 	-rm -f *.tab.c
 
-@AMDEP_TRUE@@am__include@ @am__quote@avltree/$(DEPDIR)/avl-private.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@avltree/$(DEPDIR)/avl0.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@avltree/$(DEPDIR)/avl1.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@avltree/$(DEPDIR)/avl2.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@avltree/$(DEPDIR)/avl3.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@avltree/$(DEPDIR)/avl4.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@avltree/$(DEPDIR)/avl_test.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/.dummy_hack.Po@am__quote@
 
 .c.o:
@@ -421,4 +459,18 @@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+@am__fastdepCC_TRUE@	$(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+@am__fastdepCC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
 
 ID: $(am__tagged_files)
@@ -542,8 +594,8 @@
 clean: clean-am
 
-clean-am: clean-generic clean-local mostlyclean-am
+clean-am: clean-generic clean-libtool clean-local mostlyclean-am
 
 distclean: distclean-am
-	-rm -rf avltree/$(DEPDIR)
+	-rm -rf ./$(DEPDIR)
 	-rm -f Makefile
 distclean-am: clean-am distclean-compile distclean-generic \
@@ -591,5 +643,5 @@
 
 maintainer-clean: maintainer-clean-am
-	-rm -rf avltree/$(DEPDIR)
+	-rm -rf ./$(DEPDIR)
 	-rm -f Makefile
 maintainer-clean-am: distclean-am maintainer-clean-generic
@@ -597,5 +649,6 @@
 mostlyclean: mostlyclean-am
 
-mostlyclean-am: mostlyclean-compile mostlyclean-generic
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool
 
 pdf: pdf-am
@@ -612,14 +665,15 @@
 
 .PHONY: CTAGS GTAGS TAGS all all-am all-local check check-am clean \
-	clean-generic clean-local cscopelist-am ctags ctags-am \
-	distclean distclean-compile distclean-generic distclean-tags \
-	distdir dvi dvi-am html html-am info info-am install \
-	install-am install-data install-data-am install-dvi \
-	install-dvi-am install-exec install-exec-am install-html \
-	install-html-am install-info install-info-am install-man \
-	install-pdf install-pdf-am install-ps install-ps-am \
-	install-strip installcheck installcheck-am installdirs \
-	maintainer-clean maintainer-clean-generic mostlyclean \
-	mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \
+	clean-generic clean-libtool clean-local cscopelist-am ctags \
+	ctags-am distclean distclean-compile distclean-generic \
+	distclean-libtool distclean-tags distdir dvi dvi-am html \
+	html-am info info-am install install-am install-data \
+	install-data-am install-dvi install-dvi-am install-exec \
+	install-exec-am install-html install-html-am install-info \
+	install-info-am install-man install-pdf install-pdf-am \
+	install-ps install-ps-am install-strip installcheck \
+	installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-compile \
+	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
 	tags tags-am uninstall uninstall-am
 
@@ -659,5 +713,6 @@
 	@echo "int main() { return 0; }" > ${@}
 
-dummy_hack.c:
+# automake doesn't know we still need C rules so pretend like we have a C program
+.dummy_hack.c:
 	@echo "int main() { return 0; }" > ${@}
 
@@ -668,7 +723,4 @@
 
 # implicit rule so not all test require a rule
-% : %.c $(CFACC)
-	$(PRETTY_PATH) $(CFACOMPILE) $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})
-
 % : %.cfa $(CFACC)
 	$(PRETTY_PATH) $(CFACOMPILE) $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})
@@ -699,5 +751,5 @@
 
 #builtins
-builtins/sync: builtins/sync.c $(CFACC)
+builtins/sync: builtins/sync.cfa $(CFACC)
 	$(PRETTY_PATH) $(CFACOMPILE) $(shell realpath --relative-to=${srcdir} ${<}) 2> $(abspath ${@}) -fsyntax-only
 
@@ -724,18 +776,18 @@
 
 # Constructor/destructor tests
-raii/dtor-early-exit-ERR1: raii/dtor-early-exit.c $(CFACC)
+raii/dtor-early-exit-ERR1: raii/dtor-early-exit.cfa $(CFACC)
 	$(PRETTY_PATH) $(CFACOMPILE) -DERR1 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})
 
-raii/dtor-early-exit-ERR2: raii/dtor-early-exit.c $(CFACC)
+raii/dtor-early-exit-ERR2: raii/dtor-early-exit.cfa $(CFACC)
 	$(PRETTY_PATH) $(CFACOMPILE) -DERR2 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})
 
-raii/memberCtors-ERR1: raii/memberCtors.c $(CFACC)
+raii/memberCtors-ERR1: raii/memberCtors.cfa $(CFACC)
 	$(PRETTY_PATH) $(CFACOMPILE) -DERR1 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})
 
-raii/ctor-autogen-ERR1: raii/ctor-autogen.c $(CFACC)
+raii/ctor-autogen-ERR1: raii/ctor-autogen.cfa $(CFACC)
 	$(PRETTY_PATH) $(CFACOMPILE) -DERR1 $(shell realpath --relative-to=${srcdir} ${<}) -o $(abspath ${@})
 
 # Warnings
-warnings/self-assignment: warnings/self-assignment.c $(CFACC)
+warnings/self-assignment: warnings/self-assignment.cfa $(CFACC)
 	$(PRETTY_PATH) $(CFACOMPILE) $(shell realpath --relative-to=${srcdir} ${<}) 2> $(abspath ${@}) -fsyntax-only
 
Index: tests/avltree/avl-private.c
===================================================================
--- tests/avltree/avl-private.c	(revision d5b2ac82c5d162b3f54cf7db3bdcbb3a48149204)
+++ 	(revision )
@@ -1,134 +1,0 @@
-#include "avl.h"
-#include "avl-private.h"
-
-// AVL tree specific (internal) operations:
-// rotateLeft, rotateRight, fix
-//
-// AVL tree enhanced height operation
-//
-// calcBalance is a simple computation of height(R) - height(L)
-
-// an AVL tree's height is easy to compute
-// just follow path with the larger balance
-forall(otype K | Comparable(K), otype V)
-int height(tree(K, V) * t){
-  int helper(tree(K, V) * t, int ht){
-    if (empty(t)){
-      return ht;
-    } else if (t->balance > 0){
-      return helper(t->right, 1+ht);
-    } else {
-      // can traverse either branch to find the height
-      // of an AVL tree whose balance is 0
-      return helper(t->left, 1+ht);
-    }
-  }
-  return helper(t, 0);
-}
-
-forall(otype K | Comparable(K), otype V)
-int calcBalance(tree(K, V) * t){
-  int l = height(t->left);
-  int r = height(t->right);
-  t->balance = r-l;
-  return t->balance;
-}
-
-// re-establish the link between parent and child
-forall(otype K | Comparable(K), otype V)
-void relinkToParent(tree(K, V) * t){
-  tree(K, V) * parent = t->parent; // FIX ME!!
-  if (empty(t->parent)){
-    return;
-  } else if (parent->key < t->key){
-    parent->right = t;
-  } else {
-    parent->left = t;
-  }
-}
-
-// rotate left from t
-forall(otype K | Comparable(K), otype V)
-tree(K, V) * rotateLeft(tree(K, V) * t){
-  tree(K, V) * newRoot = t->right;
-  t->right = newRoot->left;
-  newRoot->left = t;
-
-  // swap parents
-  newRoot->parent = t->parent;
-  t->parent = newRoot;
-  if (t->right != NULL) {
-    tree(K, V) * right = t->right; // FIX ME!!
-    right->parent = t;
-  }
-  // re-establish the link between newRoot and its parent
-  relinkToParent(newRoot);
-  return newRoot;
-}
-
-// rotate right from t
-forall(otype K | Comparable(K), otype V)
-tree(K, V) * rotateRight(tree(K, V) * t){
-  tree(K, V) * newRoot = t->left;
-  t->left = newRoot->right;
-  newRoot->right = t;
-
-  // swap parents
-  newRoot->parent = t->parent;
-  t->parent = newRoot;
-  if (t->left != NULL){
-    tree(K, V) * left = t->left; // FIX ME!!
-    left->parent = t;
-  }
-  // re-establish the link between newRoot and its parent
-  relinkToParent(newRoot);
-  return newRoot;
-}
-
-// balances a node that has balance factor -2 or 2
-forall(otype K | Comparable(K), otype V)
-tree(K, V) * fix(tree(K, V) * t){
-  // ensure that t's balance factor is one of
-  // the appropriate values
-  assert(t->balance == 2 || t->balance == -2);
-
-  if (t->balance == -2){
-    tree(K, V) * left = t->left; // FIX ME!!
-    if (left->balance == 1){
-      t->left = rotateLeft(t->left);
-    }
-    return rotateRight(t);
-  } else if (t->balance == 2){
-    tree(K, V) * right = t->right; // FIX ME!!
-    if (right->balance == -1){
-      t->right = rotateRight(t->right);
-    }
-    return rotateLeft(t);
-  } else {
-    // shouldn't ever get here
-    assert((int)0);
-    return t;
-  }
-}
-
-// attempt to fix the tree, if necessary
-forall(otype K | Comparable(K), otype V)
-tree(K, V) * tryFix(tree(K, V) * t){
-  int b = calcBalance(t);
-
-  if (b == -2 || b == 2){
-    t = fix(t);
-  } else {
-    assert(b == 0 || b == 1 || b == -1);
-  }
-  return t;
-}
-
-// sets parent field of c to be p
-forall(otype K | Comparable(K), otype V)
-void setParent(tree(K, V) * c, tree(K, V) * p){
-  if (! empty(c)){
-    c->parent = p;
-  }
-}
-
Index: tests/avltree/avl-private.cfa
===================================================================
--- tests/avltree/avl-private.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
+++ tests/avltree/avl-private.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
@@ -0,0 +1,134 @@
+#include "avl.h"
+#include "avl-private.h"
+
+// AVL tree specific (internal) operations:
+// rotateLeft, rotateRight, fix
+//
+// AVL tree enhanced height operation
+//
+// calcBalance is a simple computation of height(R) - height(L)
+
+// an AVL tree's height is easy to compute
+// just follow path with the larger balance
+forall(otype K | Comparable(K), otype V)
+int height(tree(K, V) * t){
+  int helper(tree(K, V) * t, int ht){
+    if (empty(t)){
+      return ht;
+    } else if (t->balance > 0){
+      return helper(t->right, 1+ht);
+    } else {
+      // can traverse either branch to find the height
+      // of an AVL tree whose balance is 0
+      return helper(t->left, 1+ht);
+    }
+  }
+  return helper(t, 0);
+}
+
+forall(otype K | Comparable(K), otype V)
+int calcBalance(tree(K, V) * t){
+  int l = height(t->left);
+  int r = height(t->right);
+  t->balance = r-l;
+  return t->balance;
+}
+
+// re-establish the link between parent and child
+forall(otype K | Comparable(K), otype V)
+void relinkToParent(tree(K, V) * t){
+  tree(K, V) * parent = t->parent; // FIX ME!!
+  if (empty(t->parent)){
+    return;
+  } else if (parent->key < t->key){
+    parent->right = t;
+  } else {
+    parent->left = t;
+  }
+}
+
+// rotate left from t
+forall(otype K | Comparable(K), otype V)
+tree(K, V) * rotateLeft(tree(K, V) * t){
+  tree(K, V) * newRoot = t->right;
+  t->right = newRoot->left;
+  newRoot->left = t;
+
+  // swap parents
+  newRoot->parent = t->parent;
+  t->parent = newRoot;
+  if (t->right != NULL) {
+    tree(K, V) * right = t->right; // FIX ME!!
+    right->parent = t;
+  }
+  // re-establish the link between newRoot and its parent
+  relinkToParent(newRoot);
+  return newRoot;
+}
+
+// rotate right from t
+forall(otype K | Comparable(K), otype V)
+tree(K, V) * rotateRight(tree(K, V) * t){
+  tree(K, V) * newRoot = t->left;
+  t->left = newRoot->right;
+  newRoot->right = t;
+
+  // swap parents
+  newRoot->parent = t->parent;
+  t->parent = newRoot;
+  if (t->left != NULL){
+    tree(K, V) * left = t->left; // FIX ME!!
+    left->parent = t;
+  }
+  // re-establish the link between newRoot and its parent
+  relinkToParent(newRoot);
+  return newRoot;
+}
+
+// balances a node that has balance factor -2 or 2
+forall(otype K | Comparable(K), otype V)
+tree(K, V) * fix(tree(K, V) * t){
+  // ensure that t's balance factor is one of
+  // the appropriate values
+  assert(t->balance == 2 || t->balance == -2);
+
+  if (t->balance == -2){
+    tree(K, V) * left = t->left; // FIX ME!!
+    if (left->balance == 1){
+      t->left = rotateLeft(t->left);
+    }
+    return rotateRight(t);
+  } else if (t->balance == 2){
+    tree(K, V) * right = t->right; // FIX ME!!
+    if (right->balance == -1){
+      t->right = rotateRight(t->right);
+    }
+    return rotateLeft(t);
+  } else {
+    // shouldn't ever get here
+    assert((int)0);
+    return t;
+  }
+}
+
+// attempt to fix the tree, if necessary
+forall(otype K | Comparable(K), otype V)
+tree(K, V) * tryFix(tree(K, V) * t){
+  int b = calcBalance(t);
+
+  if (b == -2 || b == 2){
+    t = fix(t);
+  } else {
+    assert(b == 0 || b == 1 || b == -1);
+  }
+  return t;
+}
+
+// sets parent field of c to be p
+forall(otype K | Comparable(K), otype V)
+void setParent(tree(K, V) * c, tree(K, V) * p){
+  if (! empty(c)){
+    c->parent = p;
+  }
+}
+
Index: tests/avltree/avl0.c
===================================================================
--- tests/avltree/avl0.c	(revision d5b2ac82c5d162b3f54cf7db3bdcbb3a48149204)
+++ 	(revision )
@@ -1,11 +1,0 @@
-#include "avl.h"
-
-forall(otype T | Comparable(T))
-int ?==?(T t1, T t2) {
-  return !(t1 < t2) && !(t2 < t1);
-}
-
-forall(otype T | Comparable(T))
-int ?>?(T t1, T t2) {
-  return t2 < t1;
-}
Index: tests/avltree/avl0.cfa
===================================================================
--- tests/avltree/avl0.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
+++ tests/avltree/avl0.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
@@ -0,0 +1,11 @@
+#include "avl.h"
+
+forall(otype T | Comparable(T))
+int ?==?(T t1, T t2) {
+  return !(t1 < t2) && !(t2 < t1);
+}
+
+forall(otype T | Comparable(T))
+int ?>?(T t1, T t2) {
+  return t2 < t1;
+}
Index: tests/avltree/avl1.c
===================================================================
--- tests/avltree/avl1.c	(revision d5b2ac82c5d162b3f54cf7db3bdcbb3a48149204)
+++ 	(revision )
@@ -1,48 +1,0 @@
-#include "avl.h"
-// #include "cwrap.h"
-#include <stdlib.hfa>
-
-forall(otype K | Comparable(K), otype V)
-void ?{}(tree(K, V) &t, K key, V value){
-  (t.key) { key };
-  (t.value) { value };
-  t.parent = NULL;
-  t.left = NULL;
-  t.right = NULL;
-  t.balance = 0;
-}
-
-forall(otype K, otype V)
-void ^?{}(tree(K, V) & t){
-  delete(t.left);
-  delete(t.right);
-  ^(t.key){};
-  ^(t.value){};
-}
-
-forall(otype K | Comparable(K), otype V)
-tree(K, V) * create(K key, V value) {
-  // infinite loop trying to resolve ... t = malloc();
-  tree(K, V) * t = malloc(sizeof(tree(K,V)));
-  (*t){ key, value };
-  return t;
-}
-
-// // Helper function to print trees
-// forall(otype K | Comparable(K), otype V)
-// void printTree(tree * t, int level){
-//   if (empty(t)){
-//     return;
-//   }
-
-//   printTree(t->left, level+1);
-//   printf("key: %d, value: %s, level: %d\n", t->key, t->value, level);
-//   printTree(t->right, level+1);
-// }
-
-// // inorder traversal of t
-// // prints each key, followed by the value
-// forall(otype K | Comparable(K), otype V)
-// void printTree(tree(K, V) * t){
-//     printTree(t, 0);
-// }
Index: tests/avltree/avl1.cfa
===================================================================
--- tests/avltree/avl1.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
+++ tests/avltree/avl1.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
@@ -0,0 +1,48 @@
+#include "avl.h"
+// #include "cwrap.h"
+#include <stdlib.hfa>
+
+forall(otype K | Comparable(K), otype V)
+void ?{}(tree(K, V) &t, K key, V value){
+  (t.key) { key };
+  (t.value) { value };
+  t.parent = NULL;
+  t.left = NULL;
+  t.right = NULL;
+  t.balance = 0;
+}
+
+forall(otype K, otype V)
+void ^?{}(tree(K, V) & t){
+  delete(t.left);
+  delete(t.right);
+  ^(t.key){};
+  ^(t.value){};
+}
+
+forall(otype K | Comparable(K), otype V)
+tree(K, V) * create(K key, V value) {
+  // infinite loop trying to resolve ... t = malloc();
+  tree(K, V) * t = malloc(sizeof(tree(K,V)));
+  (*t){ key, value };
+  return t;
+}
+
+// // Helper function to print trees
+// forall(otype K | Comparable(K), otype V)
+// void printTree(tree * t, int level){
+//   if (empty(t)){
+//     return;
+//   }
+
+//   printTree(t->left, level+1);
+//   printf("key: %d, value: %s, level: %d\n", t->key, t->value, level);
+//   printTree(t->right, level+1);
+// }
+
+// // inorder traversal of t
+// // prints each key, followed by the value
+// forall(otype K | Comparable(K), otype V)
+// void printTree(tree(K, V) * t){
+//     printTree(t, 0);
+// }
Index: tests/avltree/avl2.c
===================================================================
--- tests/avltree/avl2.c	(revision d5b2ac82c5d162b3f54cf7db3bdcbb3a48149204)
+++ 	(revision )
@@ -1,84 +1,0 @@
-#include "avl.h"
-#include "avl-private.h"
-
-forall(otype K | Comparable(K), otype V)
-V * find(tree(K, V) * t, K key){
-  if (empty(t)){
-    return NULL;
-  }
-
-  if (t->key == key){
-    return &t->value;
-  } else if (t->key < key){
-    return find(t->right, key);
-  } else {
-    // t->key > key
-    return find(t->left, key);
-  }
-}
-
-forall(otype K | Comparable(K), otype V)
-int empty(tree(K, V) * t){
-  return t == NULL;
-}
-
-// returns the root of the tree
-forall(otype K | Comparable(K), otype V)
-int insert(tree(K, V) ** t, K key, V value) {
-  // handles a non-empty tree
-  // problem if the following signature is used: tries to use an adapter to call helper, but shouldn't
-  // be necessary - seems to be a problem with helper's type variables not being renamed
-  // tree(K, V) * helper(tree(K, V) * t, K key, V value){
-  tree(K, V) * helper(tree(K, V) * t){
-    if (t->key == key){
-      // ran into the same key - uh-oh
-      return NULL;
-    } else if (t->key < key){
-      if (t->right == NULL){
-        t->right = create(key, value);
-        tree(K, V) * right = t->right; // FIX ME!
-        right->parent = t;             // !!!!!!!
-        return t->right;
-      } else {
-        return helper(t->right);
-      }
-    } else {
-      if (t->left == NULL){
-        t->left = create(key, value);
-        tree(K, V) * left = t->left;   // FIX ME!
-        left->parent = t;              // !!!!!!!
-        return t->left;
-      } else {
-        return helper(t->left);
-      }
-    }
-  }
-
-  if (empty(*t)){
-    // be nice and return a new tree
-    *t = create(key, value);
-    return 0;
-  }
-  tree(K, V) * newTree = helper(*t);
-  if (newTree == NULL){
-    // insert error handling code, only possibility
-    // currently is that the key already exists
-    return 99;
-  }
-  // move up the tree, updating balance factors
-  // if the balance factor is -1, 0, or 1 keep going
-  // if the balance factor is -2 or 2, call fix
-  while (newTree->parent != NULL){ // loop until newTree == NULL?
-    newTree = tryFix(newTree);
-    tree(K, V) * parent = newTree->parent;  // FIX ME!!
-    assert(parent->left == newTree ||
-         parent->right == newTree);
-    newTree = newTree->parent;
-  }
-  insert(t, key, value);
-
-  // do it one more time - this is the root
-  newTree = tryFix(newTree);
-  *t = newTree;
-  return 0;
-}
Index: tests/avltree/avl2.cfa
===================================================================
--- tests/avltree/avl2.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
+++ tests/avltree/avl2.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
@@ -0,0 +1,84 @@
+#include "avl.h"
+#include "avl-private.h"
+
+forall(otype K | Comparable(K), otype V)
+V * find(tree(K, V) * t, K key){
+  if (empty(t)){
+    return NULL;
+  }
+
+  if (t->key == key){
+    return &t->value;
+  } else if (t->key < key){
+    return find(t->right, key);
+  } else {
+    // t->key > key
+    return find(t->left, key);
+  }
+}
+
+forall(otype K | Comparable(K), otype V)
+int empty(tree(K, V) * t){
+  return t == NULL;
+}
+
+// returns the root of the tree
+forall(otype K | Comparable(K), otype V)
+int insert(tree(K, V) ** t, K key, V value) {
+  // handles a non-empty tree
+  // problem if the following signature is used: tries to use an adapter to call helper, but shouldn't
+  // be necessary - seems to be a problem with helper's type variables not being renamed
+  // tree(K, V) * helper(tree(K, V) * t, K key, V value){
+  tree(K, V) * helper(tree(K, V) * t){
+    if (t->key == key){
+      // ran into the same key - uh-oh
+      return NULL;
+    } else if (t->key < key){
+      if (t->right == NULL){
+        t->right = create(key, value);
+        tree(K, V) * right = t->right; // FIX ME!
+        right->parent = t;             // !!!!!!!
+        return t->right;
+      } else {
+        return helper(t->right);
+      }
+    } else {
+      if (t->left == NULL){
+        t->left = create(key, value);
+        tree(K, V) * left = t->left;   // FIX ME!
+        left->parent = t;              // !!!!!!!
+        return t->left;
+      } else {
+        return helper(t->left);
+      }
+    }
+  }
+
+  if (empty(*t)){
+    // be nice and return a new tree
+    *t = create(key, value);
+    return 0;
+  }
+  tree(K, V) * newTree = helper(*t);
+  if (newTree == NULL){
+    // insert error handling code, only possibility
+    // currently is that the key already exists
+    return 99;
+  }
+  // move up the tree, updating balance factors
+  // if the balance factor is -1, 0, or 1 keep going
+  // if the balance factor is -2 or 2, call fix
+  while (newTree->parent != NULL){ // loop until newTree == NULL?
+    newTree = tryFix(newTree);
+    tree(K, V) * parent = newTree->parent;  // FIX ME!!
+    assert(parent->left == newTree ||
+         parent->right == newTree);
+    newTree = newTree->parent;
+  }
+  insert(t, key, value);
+
+  // do it one more time - this is the root
+  newTree = tryFix(newTree);
+  *t = newTree;
+  return 0;
+}
Index: tests/avltree/avl3.c
===================================================================
--- tests/avltree/avl3.c	(revision d5b2ac82c5d162b3f54cf7db3bdcbb3a48149204)
+++ 	(revision )
@@ -1,118 +1,0 @@
-#include "avl.h"
-#include "avl-private.h"
-#include <stdlib.hfa>
-
-// swaps the data within two tree nodes
-forall(otype K | Comparable(K), otype V)
-void node_swap(tree(K, V) * t, tree(K, V) * t2){
-	swap( t->key,  t2->key);
-	swap( t->value, t2->value);
-}
-
-// go left as deep as possible from within the right subtree
-forall(otype K | Comparable(K), otype V)
-tree(K, V) * find_successor(tree(K, V) * t){
-	tree(K, V) * find_successor_helper(tree(K, V) * t){
-		// go left as deep as possible, return the last node
-		if (empty(t->left)){
-			return t;
-		} else {
-			return find_successor_helper(t->left);
-		}
-	}
-	return find_successor_helper(t->right);
-}
-
-// cleanup - don't want to deep delete, so set children to NULL first.
-forall(otype K | Comparable(K), otype V)
-void deleteSingleNode(tree(K, V) * t) {
-	t->left = NULL;
-	t->right = NULL;
-	delete(t);
-}
-
-// does the actual remove operation once we've found the node in question
-forall(otype K | Comparable(K), otype V)
-tree(K, V) * remove_node(tree(K, V) * t){
-	// is the node a leaf?
-	if (empty(t->left) && empty(t->right)){
-		// yes, just delete this node
-		delete(t);
-		return NULL;
-	} else if (empty(t->left)){
-		// if the left is empty, there is only one child -> move right up
-		node_swap(t, t->right);
-		tree(K, V) * tmp = t->right;
-
-		// relink tree
-		t->left = tmp->left;
-		t->right = tmp->right;
-
-		setParent(t->left, t);
-		setParent(t->right, t);
-		deleteSingleNode(tmp);
-		return t;
-	} else if (empty(t->right)){
-		// if the right is empty, there is only one child -> move left up
-		node_swap(t, t->left);
-		tree(K, V) * tmp = t->left;
-
-		// relink tree
-		t->left = tmp->left;
-		t->right = tmp->right;
-
-		setParent(t->left, t);
-		setParent(t->right, t);
-		deleteSingleNode(tmp);
-		return t;
-	} else {
-		// swap with the successor
-		tree(K, V) * s = find_successor(t);
-		tree(K, V) * parent = s->parent;
-
-		if (parent->left == s){
-			parent->left = s->right;
-		} else {
-			assert(parent->right == s);
-			parent->right = s->right;
-		}
-		setParent(s->right, parent);
-		node_swap(t, s);
-		deleteSingleNode(s);
-		return t;
-	}
-}
-
-// finds the node that needs to be removed
-forall(otype K | Comparable(K), otype V)
-tree(K, V) * remove_helper(tree(K, V) * t, K key, int * worked){
-	if (empty(t)){
-		// did not work because key was not found
-		// set the status variable and return
-		*worked = 1;
-	} else if (t->key == key) {
-		t = remove_node(t);
-	} else if (t->key < key){
-		t->right = remove_helper(t->right, key, worked);
-	} else {
-		// t->key > key
-		t->left = remove_helper(t->left, key, worked);
-	}
-	// try to fix after deleting
-	if (! empty(t)) {
-		t = tryFix(t);
-	}
-	return t;
-}
-
-forall(otype K | Comparable(K), otype V)
-int remove(tree(K, V) ** t, K key){
-	int worked = 0;
-	tree(K, V) * newTree = remove_helper(*t, key, &worked);
-	*t = newTree;
-	return worked;
-}
-
-// Local Variables: //
-// tab-width: 4 //
-// End: //
Index: tests/avltree/avl3.cfa
===================================================================
--- tests/avltree/avl3.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
+++ tests/avltree/avl3.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
@@ -0,0 +1,118 @@
+#include "avl.h"
+#include "avl-private.h"
+#include <stdlib.hfa>
+
+// swaps the data within two tree nodes
+forall(otype K | Comparable(K), otype V)
+void node_swap(tree(K, V) * t, tree(K, V) * t2){
+	swap( t->key,  t2->key);
+	swap( t->value, t2->value);
+}
+
+// go left as deep as possible from within the right subtree
+forall(otype K | Comparable(K), otype V)
+tree(K, V) * find_successor(tree(K, V) * t){
+	tree(K, V) * find_successor_helper(tree(K, V) * t){
+		// go left as deep as possible, return the last node
+		if (empty(t->left)){
+			return t;
+		} else {
+			return find_successor_helper(t->left);
+		}
+	}
+	return find_successor_helper(t->right);
+}
+
+// cleanup - don't want to deep delete, so set children to NULL first.
+forall(otype K | Comparable(K), otype V)
+void deleteSingleNode(tree(K, V) * t) {
+	t->left = NULL;
+	t->right = NULL;
+	delete(t);
+}
+
+// does the actual remove operation once we've found the node in question
+forall(otype K | Comparable(K), otype V)
+tree(K, V) * remove_node(tree(K, V) * t){
+	// is the node a leaf?
+	if (empty(t->left) && empty(t->right)){
+		// yes, just delete this node
+		delete(t);
+		return NULL;
+	} else if (empty(t->left)){
+		// if the left is empty, there is only one child -> move right up
+		node_swap(t, t->right);
+		tree(K, V) * tmp = t->right;
+
+		// relink tree
+		t->left = tmp->left;
+		t->right = tmp->right;
+
+		setParent(t->left, t);
+		setParent(t->right, t);
+		deleteSingleNode(tmp);
+		return t;
+	} else if (empty(t->right)){
+		// if the right is empty, there is only one child -> move left up
+		node_swap(t, t->left);
+		tree(K, V) * tmp = t->left;
+
+		// relink tree
+		t->left = tmp->left;
+		t->right = tmp->right;
+
+		setParent(t->left, t);
+		setParent(t->right, t);
+		deleteSingleNode(tmp);
+		return t;
+	} else {
+		// swap with the successor
+		tree(K, V) * s = find_successor(t);
+		tree(K, V) * parent = s->parent;
+
+		if (parent->left == s){
+			parent->left = s->right;
+		} else {
+			assert(parent->right == s);
+			parent->right = s->right;
+		}
+		setParent(s->right, parent);
+		node_swap(t, s);
+		deleteSingleNode(s);
+		return t;
+	}
+}
+
+// finds the node that needs to be removed
+forall(otype K | Comparable(K), otype V)
+tree(K, V) * remove_helper(tree(K, V) * t, K key, int * worked){
+	if (empty(t)){
+		// did not work because key was not found
+		// set the status variable and return
+		*worked = 1;
+	} else if (t->key == key) {
+		t = remove_node(t);
+	} else if (t->key < key){
+		t->right = remove_helper(t->right, key, worked);
+	} else {
+		// t->key > key
+		t->left = remove_helper(t->left, key, worked);
+	}
+	// try to fix after deleting
+	if (! empty(t)) {
+		t = tryFix(t);
+	}
+	return t;
+}
+
+forall(otype K | Comparable(K), otype V)
+int remove(tree(K, V) ** t, K key){
+	int worked = 0;
+	tree(K, V) * newTree = remove_helper(*t, key, &worked);
+	*t = newTree;
+	return worked;
+}
+
+// Local Variables: //
+// tab-width: 4 //
+// End: //
Index: tests/avltree/avl4.c
===================================================================
--- tests/avltree/avl4.c	(revision d5b2ac82c5d162b3f54cf7db3bdcbb3a48149204)
+++ 	(revision )
@@ -1,48 +1,0 @@
-#include "avl.h"
-#include "avl-private.h"
-
-// Perform a shallow copy of src, return the
-// new tree in ret
-forall(otype K | Comparable(K), otype V)
-int copy(tree(K, V) * src, tree(K, V) ** ret){
-  tree(K, V) * helper(tree(K, V) * t, int * worked){
-    if (empty(t)){
-      // given empty tree, return empty tree
-      return NULL;
-    }
-
-    // otherwise, this is not an empty node,
-    // create a new node
-    tree(K, V) * newTree = create(t->key, t->value);
-    if (empty(newTree)) {
-      *worked = 1;
-      return NULL;
-    }
-
-    // recursively copy the left and right branches
-    newTree->left = helper(t->left, worked);
-    newTree->right = helper(t->right, worked);
-
-    setParent(newTree->left, newTree);
-    setParent(newTree->right, newTree);
-    return newTree;
-  }
-
-  int worked = 0;
-  *ret = helper(src, &worked);
-  return worked;
-}
-
-// Apply func to every value element in t, using an in order traversal
-forall(otype K | Comparable(K), otype V)
-void for_each(tree(K, V) * t, int (*func)(V)) {
-  if (t == NULL) {
-    return;
-  }
-  // recursively apply the function to the left,
-  // apply the function to this node,
-  // recursively apply the function to the right
-  for_each(t->left, func);
-  func(t->value);
-  for_each(t->right, func);
-}
Index: tests/avltree/avl4.cfa
===================================================================
--- tests/avltree/avl4.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
+++ tests/avltree/avl4.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
@@ -0,0 +1,48 @@
+#include "avl.h"
+#include "avl-private.h"
+
+// Perform a shallow copy of src, return the
+// new tree in ret
+forall(otype K | Comparable(K), otype V)
+int copy(tree(K, V) * src, tree(K, V) ** ret){
+  tree(K, V) * helper(tree(K, V) * t, int * worked){
+    if (empty(t)){
+      // given empty tree, return empty tree
+      return NULL;
+    }
+
+    // otherwise, this is not an empty node,
+    // create a new node
+    tree(K, V) * newTree = create(t->key, t->value);
+    if (empty(newTree)) {
+      *worked = 1;
+      return NULL;
+    }
+
+    // recursively copy the left and right branches
+    newTree->left = helper(t->left, worked);
+    newTree->right = helper(t->right, worked);
+
+    setParent(newTree->left, newTree);
+    setParent(newTree->right, newTree);
+    return newTree;
+  }
+
+  int worked = 0;
+  *ret = helper(src, &worked);
+  return worked;
+}
+
+// Apply func to every value element in t, using an in order traversal
+forall(otype K | Comparable(K), otype V)
+void for_each(tree(K, V) * t, int (*func)(V)) {
+  if (t == NULL) {
+    return;
+  }
+  // recursively apply the function to the left,
+  // apply the function to this node,
+  // recursively apply the function to the right
+  for_each(t->left, func);
+  func(t->value);
+  for_each(t->right, func);
+}
Index: tests/avltree/avl_test.c
===================================================================
--- tests/avltree/avl_test.c	(revision d5b2ac82c5d162b3f54cf7db3bdcbb3a48149204)
+++ 	(revision )
@@ -1,52 +1,0 @@
-#include "avl.h"
-#include "avl-private.h"
-#include <stdlib.hfa>
-
-extern "C" {
-  int strcmp(const char *, const char *);
-}
-
-int main(){
-  // operations:
-  // find(tree(K, V) *, K)
-  // int empty(tree(K, V) *);
-  // tree(K, V) * insert(tree(K, V) *, K, V);
-  // int remove(tree(K, V) **, K);
-
-  // int -> int
-  tree(int, int) * imap = create(-1, (int)0);
-  insert(&imap, 12, 13);
-  insert(&imap, 2, 3);
-  assert( height(imap) == 2 );
-
-  printf("%d %d %d\n", *find(imap, 2), *find(imap, 12), *find(imap, -1));
-
-  remove(&imap, -1);
-  delete(imap);
-
-  // int -> char *
-  tree(int, const char *) * smap = create(-1, "baz");
-  insert(&smap, 12, "bar");
-  insert(&smap, 2, "foo");
-  assert( height(smap) == 2 );
-
-  printf("%s %s %s\n", *find(smap, 2), *find(smap, 12), *find(smap, -1));
-
-  remove(&smap, -2);
-  delete(smap);
-
-  // const char* -> const char*
-  int ?<?(const char * a, const char * b) {
-    return strcmp(a, b) < 0;
-  }
-
-  tree(const char *, const char *) * ssmap = create("queso", "cheese");
-  insert(&ssmap, "foo", "bar");
-  insert(&ssmap, "hello", "world");
-  assert( height(ssmap) == 2 );
-
-  printf("%s %s %s\n", *find(ssmap, "hello"), *find(ssmap, "foo"), *find(ssmap, "queso"));
-
-  remove(&ssmap, "foo");
-  delete(ssmap);
-}
Index: tests/avltree/avl_test.cfa
===================================================================
--- tests/avltree/avl_test.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
+++ tests/avltree/avl_test.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
@@ -0,0 +1,52 @@
+#include "avl.h"
+#include "avl-private.h"
+#include <stdlib.hfa>
+
+extern "C" {
+  int strcmp(const char *, const char *);
+}
+
+int main(){
+  // operations:
+  // find(tree(K, V) *, K)
+  // int empty(tree(K, V) *);
+  // tree(K, V) * insert(tree(K, V) *, K, V);
+  // int remove(tree(K, V) **, K);
+
+  // int -> int
+  tree(int, int) * imap = create(-1, (int)0);
+  insert(&imap, 12, 13);
+  insert(&imap, 2, 3);
+  assert( height(imap) == 2 );
+
+  printf("%d %d %d\n", *find(imap, 2), *find(imap, 12), *find(imap, -1));
+
+  remove(&imap, -1);
+  delete(imap);
+
+  // int -> char *
+  tree(int, const char *) * smap = create(-1, "baz");
+  insert(&smap, 12, "bar");
+  insert(&smap, 2, "foo");
+  assert( height(smap) == 2 );
+
+  printf("%s %s %s\n", *find(smap, 2), *find(smap, 12), *find(smap, -1));
+
+  remove(&smap, -2);
+  delete(smap);
+
+  // const char* -> const char*
+  int ?<?(const char * a, const char * b) {
+    return strcmp(a, b) < 0;
+  }
+
+  tree(const char *, const char *) * ssmap = create("queso", "cheese");
+  insert(&ssmap, "foo", "bar");
+  insert(&ssmap, "hello", "world");
+  assert( height(ssmap) == 2 );
+
+  printf("%s %s %s\n", *find(ssmap, "hello"), *find(ssmap, "foo"), *find(ssmap, "queso"));
+
+  remove(&ssmap, "foo");
+  delete(ssmap);
+}
Index: tests/builtins/sync.c
===================================================================
--- tests/builtins/sync.c	(revision d5b2ac82c5d162b3f54cf7db3bdcbb3a48149204)
+++ 	(revision )
@@ -1,468 +1,0 @@
-#include <stdbool.h>
-#include <stdint.h>
-
-void foo() {
-	volatile _Bool * vpB = 0; _Bool vB = 0;
-	volatile char * vp1 = 0; char * rp1 = 0; char v1 = 0;
-	volatile short * vp2 = 0; short * rp2 = 0; short v2 = 0;
-	volatile int * vp4 = 0; int * rp4 = 0; int v4 = 0;
-	volatile long long int * vp8 = 0; long long int * rp8 = 0; long long int v8 = 0;
-	#if defined(__SIZEOF_INT128__)
-	volatile __int128 * vp16 = 0; __int128 * rp16 = 0; __int128 v16 = 0;
-	#endif
-
-	{ char ret; ret = __sync_fetch_and_add(vp1, v1); }
-	{ char ret; ret = __sync_fetch_and_add_1(vp1, v1); }
-	{ short ret; ret = __sync_fetch_and_add(vp2, v2); }
-	{ short ret; ret = __sync_fetch_and_add_2(vp2, v2); }
-	{ int ret; ret = __sync_fetch_and_add(vp4, v4); }
-	{ int ret; ret = __sync_fetch_and_add_4(vp4, v4); }
-	{ long long int ret; ret = __sync_fetch_and_add(vp8, v8); }
-	{ long long int ret; ret = __sync_fetch_and_add_8(vp8, v8); }
-	#if defined(__SIZEOF_INT128__)
-	{ __int128 ret; ret = __sync_fetch_and_add(vp16, v16); }
-	{ __int128 ret; ret = __sync_fetch_and_add_16(vp16, v16); }
-	#endif
-
-	{ char ret; ret = __sync_fetch_and_sub(vp1, v1); }
-	{ char ret; ret = __sync_fetch_and_sub_1(vp1, v1); }
-	{ short ret; ret = __sync_fetch_and_sub(vp2, v2); }
-	{ short ret; ret = __sync_fetch_and_sub_2(vp2, v2); }
-	{ int ret; ret = __sync_fetch_and_sub(vp4, v4); }
-	{ int ret; ret = __sync_fetch_and_sub_4(vp4, v4); }
-	{ long long int ret; ret = __sync_fetch_and_sub(vp8, v8); }
-	{ long long int ret; ret = __sync_fetch_and_sub_8(vp8, v8); }
-	#if defined(__SIZEOF_INT128__)
-	{ __int128 ret; ret = __sync_fetch_and_sub(vp16, v16); }
-	{ __int128 ret; ret = __sync_fetch_and_sub_16(vp16, v16); }
-	#endif
-
-	{ char ret; ret = __sync_fetch_and_or(vp1, v1); }
-	{ char ret; ret = __sync_fetch_and_or_1(vp1, v1); }
-	{ short ret; ret = __sync_fetch_and_or(vp2, v2); }
-	{ short ret; ret = __sync_fetch_and_or_2(vp2, v2); }
-	{ int ret; ret = __sync_fetch_and_or(vp4, v4); }
-	{ int ret; ret = __sync_fetch_and_or_4(vp4, v4); }
-	{ long long int ret; ret = __sync_fetch_and_or(vp8, v8); }
-	{ long long int ret; ret = __sync_fetch_and_or_8(vp8, v8); }
-	#if defined(__SIZEOF_INT128__)
-	{ __int128 ret; ret = __sync_fetch_and_or(vp16, v16); }
-	{ __int128 ret; ret = __sync_fetch_and_or_16(vp16, v16); }
-	#endif
-
-	{ char ret; ret = __sync_fetch_and_and(vp1, v1); }
-	{ char ret; ret = __sync_fetch_and_and_1(vp1, v1); }
-	{ short ret; ret = __sync_fetch_and_and(vp2, v2); }
-	{ short ret; ret = __sync_fetch_and_and_2(vp2, v2); }
-	{ int ret; ret = __sync_fetch_and_and(vp4, v4); }
-	{ int ret; ret = __sync_fetch_and_and_4(vp4, v4); }
-	{ long long int ret; ret = __sync_fetch_and_and(vp8, v8); }
-	{ long long int ret; ret = __sync_fetch_and_and_8(vp8, v8); }
-	#if defined(__SIZEOF_INT128__)
-	{ __int128 ret; ret = __sync_fetch_and_and(vp16, v16); }
-	{ __int128 ret; ret = __sync_fetch_and_and_16(vp16, v16); }
-	#endif
-
-	{ char ret; ret = __sync_fetch_and_xor(vp1, v1); }
-	{ char ret; ret = __sync_fetch_and_xor_1(vp1, v1); }
-	{ short ret; ret = __sync_fetch_and_xor(vp2, v2); }
-	{ short ret; ret = __sync_fetch_and_xor_2(vp2, v2); }
-	{ int ret; ret = __sync_fetch_and_xor(vp4, v4); }
-	{ int ret; ret = __sync_fetch_and_xor_4(vp4, v4); }
-	{ long long int ret; ret = __sync_fetch_and_xor(vp8, v8); }
-	{ long long int ret; ret = __sync_fetch_and_xor_8(vp8, v8); }
-	#if defined(__SIZEOF_INT128__)
-	{ __int128 ret; ret = __sync_fetch_and_xor(vp16, v16); }
-	{ __int128 ret; ret = __sync_fetch_and_xor_16(vp16, v16); }
-	#endif
-
-	{ char ret; ret = __sync_fetch_and_nand(vp1, v1); }
-	{ char ret; ret = __sync_fetch_and_nand_1(vp1, v1); }
-	{ short ret; ret = __sync_fetch_and_nand(vp2, v2); }
-	{ short ret; ret = __sync_fetch_and_nand_2(vp2, v2); }
-	{ int ret; ret = __sync_fetch_and_nand(vp4, v4); }
-	{ int ret; ret = __sync_fetch_and_nand_4(vp4, v4); }
-	{ long long int ret; ret = __sync_fetch_and_nand(vp8, v8); }
-	{ long long int ret; ret = __sync_fetch_and_nand_8(vp8, v8); }
-	#if defined(__SIZEOF_INT128__)
-	{ __int128 ret; ret = __sync_fetch_and_nand(vp16, v16); }
-	{ __int128 ret; ret = __sync_fetch_and_nand_16(vp16, v16); }
-	#endif
-
-	{ char ret; ret = __sync_add_and_fetch(vp1, v1); }
-	{ char ret; ret = __sync_add_and_fetch_1(vp1, v1); }
-	{ short ret; ret = __sync_add_and_fetch(vp2, v2); }
-	{ short ret; ret = __sync_add_and_fetch_2(vp2, v2); }
-	{ int ret; ret = __sync_add_and_fetch(vp4, v4); }
-	{ int ret; ret = __sync_add_and_fetch_4(vp4, v4); }
-	{ long long int ret; ret = __sync_add_and_fetch(vp8, v8); }
-	{ long long int ret; ret = __sync_add_and_fetch_8(vp8, v8); }
-	#if defined(__SIZEOF_INT128__)
-	{ __int128 ret; ret = __sync_add_and_fetch(vp16, v16); }
-	{ __int128 ret; ret = __sync_add_and_fetch_16(vp16, v16); }
-	#endif
-
-	{ char ret; ret = __sync_sub_and_fetch(vp1, v1); }
-	{ char ret; ret = __sync_sub_and_fetch_1(vp1, v1); }
-	{ short ret; ret = __sync_sub_and_fetch(vp2, v2); }
-	{ short ret; ret = __sync_sub_and_fetch_2(vp2, v2); }
-	{ int ret; ret = __sync_sub_and_fetch(vp4, v4); }
-	{ int ret; ret = __sync_sub_and_fetch_4(vp4, v4); }
-	{ long long int ret; ret = __sync_sub_and_fetch(vp8, v8); }
-	{ long long int ret; ret = __sync_sub_and_fetch_8(vp8, v8); }
-	#if defined(__SIZEOF_INT128__)
-	{ __int128 ret; ret = __sync_sub_and_fetch(vp16, v16); }
-	{ __int128 ret; ret = __sync_sub_and_fetch_16(vp16, v16); }
-	#endif
-
-	{ char ret; ret = __sync_or_and_fetch(vp1, v1); }
-	{ char ret; ret = __sync_or_and_fetch_1(vp1, v1); }
-	{ short ret; ret = __sync_or_and_fetch(vp2, v2); }
-	{ short ret; ret = __sync_or_and_fetch_2(vp2, v2); }
-	{ int ret; ret = __sync_or_and_fetch(vp4, v4); }
-	{ int ret; ret = __sync_or_and_fetch_4(vp4, v4); }
-	{ long long int ret; ret = __sync_or_and_fetch(vp8, v8); }
-	{ long long int ret; ret = __sync_or_and_fetch_8(vp8, v8); }
-	#if defined(__SIZEOF_INT128__)
-	{ __int128 ret; ret = __sync_or_and_fetch(vp16, v16); }
-	{ __int128 ret; ret = __sync_or_and_fetch_16(vp16, v16); }
-	#endif
-
-	{ char ret; ret = __sync_and_and_fetch(vp1, v1); }
-	{ char ret; ret = __sync_and_and_fetch_1(vp1, v1); }
-	{ short ret; ret = __sync_and_and_fetch(vp2, v2); }
-	{ short ret; ret = __sync_and_and_fetch_2(vp2, v2); }
-	{ int ret; ret = __sync_and_and_fetch(vp4, v4); }
-	{ int ret; ret = __sync_and_and_fetch_4(vp4, v4); }
-	{ long long int ret; ret = __sync_and_and_fetch(vp8, v8); }
-	{ long long int ret; ret = __sync_and_and_fetch_8(vp8, v8); }
-	#if defined(__SIZEOF_INT128__)
-	{ __int128 ret; ret = __sync_and_and_fetch(vp16, v16); }
-	{ __int128 ret; ret = __sync_and_and_fetch_16(vp16, v16); }
-	#endif
-
-	{ char ret; ret = __sync_xor_and_fetch(vp1, v1); }
-	{ char ret; ret = __sync_xor_and_fetch_1(vp1, v1); }
-	{ short ret; ret = __sync_xor_and_fetch(vp2, v2); }
-	{ short ret; ret = __sync_xor_and_fetch_2(vp2, v2); }
-	{ int ret; ret = __sync_xor_and_fetch(vp4, v4); }
-	{ int ret; ret = __sync_xor_and_fetch_4(vp4, v4); }
-	{ long long int ret; ret = __sync_xor_and_fetch(vp8, v8); }
-	{ long long int ret; ret = __sync_xor_and_fetch_8(vp8, v8); }
-	#if defined(__SIZEOF_INT128__)
-	{ __int128 ret; ret = __sync_xor_and_fetch(vp16, v16); }
-	{ __int128 ret; ret = __sync_xor_and_fetch_16(vp16, v16); }
-	#endif
-
-	{ char ret; ret = __sync_nand_and_fetch(vp1, v1); }
-	{ char ret; ret = __sync_nand_and_fetch_1(vp1, v1); }
-	{ short ret; ret = __sync_nand_and_fetch(vp2, v2); }
-	{ short ret; ret = __sync_nand_and_fetch_2(vp2, v2); }
-	{ int ret; ret = __sync_nand_and_fetch(vp4, v4); }
-	{ int ret; ret = __sync_nand_and_fetch_4(vp4, v4); }
-	{ long long int ret; ret = __sync_nand_and_fetch(vp8, v8); }
-	{ long long int ret; ret = __sync_nand_and_fetch_8(vp8, v8); }
-	#if defined(__SIZEOF_INT128__)
-	{ __int128 ret; ret = __sync_nand_and_fetch(vp16, v16); }
-	{ __int128 ret; ret = __sync_nand_and_fetch_16(vp16, v16); }
-	#endif
-
-	{ _Bool ret; ret = __sync_bool_compare_and_swap(vp1, v1, v1); }
-	{ _Bool ret; ret = __sync_bool_compare_and_swap_1(vp1, v1, v1); }
-	{ _Bool ret; ret = __sync_bool_compare_and_swap(vp2, v2, v2); }
-	{ _Bool ret; ret = __sync_bool_compare_and_swap_2(vp2, v2, v2); }
-	{ _Bool ret; ret = __sync_bool_compare_and_swap(vp4, v4, v4); }
-	{ _Bool ret; ret = __sync_bool_compare_and_swap_4(vp4, v4, v4); }
-	{ _Bool ret; ret = __sync_bool_compare_and_swap(vp8, v8, v8); }
-	{ _Bool ret; ret = __sync_bool_compare_and_swap_8(vp8, v8, v8); }
-	#if defined(__SIZEOF_INT128__)
-	{ _Bool ret; ret = __sync_bool_compare_and_swap(vp16, v16, v16); }
-	{ _Bool ret; ret = __sync_bool_compare_and_swap_16(vp16, v16,v16); }
-	#endif
-
-	{ char ret; ret = __sync_val_compare_and_swap(vp1, v1, v1); }
-	{ char ret; ret = __sync_val_compare_and_swap_1(vp1, v1, v1); }
-	{ short ret; ret = __sync_val_compare_and_swap(vp2, v2, v2); }
-	{ short ret; ret = __sync_val_compare_and_swap_2(vp2, v2, v2); }
-	{ int ret; ret = __sync_val_compare_and_swap(vp4, v4, v4); }
-	{ int ret; ret = __sync_val_compare_and_swap_4(vp4, v4, v4); }
-	{ long long int ret; ret = __sync_val_compare_and_swap(vp8, v8, v8); }
-	{ long long int ret; ret = __sync_val_compare_and_swap_8(vp8, v8, v8); }
-	#if defined(__SIZEOF_INT128__)
-	{ __int128 ret; ret = __sync_val_compare_and_swap(vp16, v16, v16); }
-	{ __int128 ret; ret = __sync_val_compare_and_swap_16(vp16, v16,v16); }
-	#endif
-
-	{ char ret; ret = __sync_lock_test_and_set(vp1, v1); }
-	{ char ret; ret = __sync_lock_test_and_set_1(vp1, v1); }
-	{ short ret; ret = __sync_lock_test_and_set(vp2, v2); }
-	{ short ret; ret = __sync_lock_test_and_set_2(vp2, v2); }
-	{ int ret; ret = __sync_lock_test_and_set(vp4, v4); }
-	{ int ret; ret = __sync_lock_test_and_set_4(vp4, v4); }
-	{ long long int ret; ret = __sync_lock_test_and_set(vp8, v8); }
-	{ long long int ret; ret = __sync_lock_test_and_set_8(vp8, v8); }
-	#if defined(__SIZEOF_INT128__)
-	{ __int128 ret; ret = __sync_lock_test_and_set(vp16, v16); }
-	{ __int128 ret; ret = __sync_lock_test_and_set_16(vp16, v16); }
-	#endif
-
-	{ __sync_lock_release(vp1); }
-	{ __sync_lock_release_1(vp1); }
-	{ __sync_lock_release(vp2); }
-	{ __sync_lock_release_2(vp2); }
-	{ __sync_lock_release(vp4); }
-	{ __sync_lock_release_4(vp4); }
-	{ __sync_lock_release(vp8); }
-	{ __sync_lock_release_8(vp8); }
-	#if defined(__SIZEOF_INT128__)
-	{ __sync_lock_release(vp16); }
-	{ __sync_lock_release_16(vp16); }
-	#endif
-
-	{ __sync_synchronize(); }
-
-
-
-
-	{ _Bool ret; ret = __atomic_test_and_set(vpB, vB); }
-	{ _Bool ret; ret = __atomic_test_and_set(vp1, v1); }
-	{ __atomic_clear(vpB, vB); }
-	{ __atomic_clear(vp1, v1); }
-
-	{ char ret; ret = __atomic_exchange_n(vp1, &v1, __ATOMIC_SEQ_CST); }
-	{ char ret; ret = __atomic_exchange_1(vp1, v1, __ATOMIC_SEQ_CST); }
-	{ char ret; __atomic_exchange(vp1, &v1, &ret, __ATOMIC_SEQ_CST); }
-	{ short ret; ret = __atomic_exchange_n(vp2, &v2, __ATOMIC_SEQ_CST); }
-	{ short ret; ret = __atomic_exchange_2(vp2, v2, __ATOMIC_SEQ_CST); }
-	{ short ret; __atomic_exchange(vp2, &v2, &ret, __ATOMIC_SEQ_CST); }
-	{ int ret; ret = __atomic_exchange_n(vp4, &v4, __ATOMIC_SEQ_CST); }
-	{ int ret; ret = __atomic_exchange_4(vp4, v4, __ATOMIC_SEQ_CST); }
-	{ int ret; __atomic_exchange(vp4, &v4, &ret, __ATOMIC_SEQ_CST); }
-	{ long long int ret; ret = __atomic_exchange_n(vp8, &v8, __ATOMIC_SEQ_CST); }
-	{ long long int ret; ret = __atomic_exchange_8(vp8, v8, __ATOMIC_SEQ_CST); }
-	{ long long int ret; __atomic_exchange(vp8, &v8, &ret, __ATOMIC_SEQ_CST); }
-	#if defined(__SIZEOF_INT128__)
-	{ __int128 ret; ret = __atomic_exchange_n(vp16, &v16, __ATOMIC_SEQ_CST); }
-	{ __int128 ret; ret = __atomic_exchange_16(vp16, v16, __ATOMIC_SEQ_CST); }
-	{ __int128 ret; __atomic_exchange(vp16, &v16, &ret, __ATOMIC_SEQ_CST); }
-	#endif
-
-	{ char ret; ret = __atomic_load_n(vp1, __ATOMIC_SEQ_CST); }
-	{ char ret; ret = __atomic_load_1(vp1, __ATOMIC_SEQ_CST); }
-	{ char ret; __atomic_load(vp1, &ret, __ATOMIC_SEQ_CST); }
-	{ short ret; ret = __atomic_load_n(vp2, __ATOMIC_SEQ_CST); }
-	{ short ret; ret = __atomic_load_2(vp2, __ATOMIC_SEQ_CST); }
-	{ short ret; __atomic_load(vp2, &ret, __ATOMIC_SEQ_CST); }
-	{ int ret; ret = __atomic_load_n(vp4, __ATOMIC_SEQ_CST); }
-	{ int ret; ret = __atomic_load_4(vp4, __ATOMIC_SEQ_CST); }
-	{ int ret; __atomic_load(vp4, &ret, __ATOMIC_SEQ_CST); }
-	{ long long int ret; ret = __atomic_load_n(vp8, __ATOMIC_SEQ_CST); }
-	{ long long int ret; ret = __atomic_load_8(vp8, __ATOMIC_SEQ_CST); }
-	{ long long int ret; __atomic_load(vp8, &ret, __ATOMIC_SEQ_CST); }
-	#if defined(__SIZEOF_INT128__)
-	{ __int128 ret; ret = __atomic_load_n(vp16, __ATOMIC_SEQ_CST); }
-	{ __int128 ret; ret = __atomic_load_16(vp16, __ATOMIC_SEQ_CST); }
-	{ __int128 ret; __atomic_load(vp16, &ret, __ATOMIC_SEQ_CST); }
-	#endif
-
-	{ _Bool ret; ret = __atomic_compare_exchange_n(vp1, rp1, v1, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
-	{ _Bool ret; ret = __atomic_compare_exchange_1(vp1, rp1, v1, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
-	{ _Bool ret; ret = __atomic_compare_exchange(vp1, rp1, &v1, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
-	{ _Bool ret; ret = __atomic_compare_exchange_n(vp2, rp2, v2, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
-	{ _Bool ret; ret = __atomic_compare_exchange_2(vp2, rp2, v2, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
-	{ _Bool ret; ret = __atomic_compare_exchange(vp2, rp2, &v2, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
-	{ _Bool ret; ret = __atomic_compare_exchange_n(vp4, rp4, v4, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
-	{ _Bool ret; ret = __atomic_compare_exchange_4(vp4, rp4, v4, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
-	{ _Bool ret; ret = __atomic_compare_exchange(vp4, rp4, &v4, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
-	{ _Bool ret; ret = __atomic_compare_exchange_n(vp8, rp8, v8, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
-	{ _Bool ret; ret = __atomic_compare_exchange_8(vp8, rp8, v8, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
-	{ _Bool ret; ret = __atomic_compare_exchange(vp8, rp8, &v8, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
-	#if defined(__SIZEOF_INT128__)
-	{ _Bool ret; ret = __atomic_compare_exchange_n(vp16, rp16, v16, 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
-	{ _Bool ret; ret = __atomic_compare_exchange_16(vp16, rp16, v16, 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
-	{ _Bool ret; ret = __atomic_compare_exchange(vp16, rp16, &v16, 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
-	#endif
-
-	{ __atomic_store_n(vp1, v1, __ATOMIC_SEQ_CST); }
-	{ __atomic_store_1(vp1, v1, __ATOMIC_SEQ_CST); }
-	{ __atomic_store(vp1, &v1, __ATOMIC_SEQ_CST); }
-	{ __atomic_store_n(vp2, v2, __ATOMIC_SEQ_CST); }
-	{ __atomic_store_2(vp2, v2, __ATOMIC_SEQ_CST); }
-	{ __atomic_store(vp2, &v2, __ATOMIC_SEQ_CST); }
-	{ __atomic_store_n(vp4, v4, __ATOMIC_SEQ_CST); }
-	{ __atomic_store_4(vp4, v4, __ATOMIC_SEQ_CST); }
-	{ __atomic_store(vp4, &v4, __ATOMIC_SEQ_CST); }
-	{ __atomic_store_n(vp8, v8, __ATOMIC_SEQ_CST); }
-	{ __atomic_store_8(vp8, v8, __ATOMIC_SEQ_CST); }
-	{ __atomic_store(vp8, &v8, __ATOMIC_SEQ_CST); }
-	#if defined(__SIZEOF_INT128__)
-	{ __atomic_store_n(vp16, v16, __ATOMIC_SEQ_CST); }
-	{ __atomic_store_16(vp16, v16, __ATOMIC_SEQ_CST); }
-	{ __atomic_store(vp16, &v16, __ATOMIC_SEQ_CST); }
-	#endif
-
-	{ char ret; ret = __atomic_add_fetch(vp1, v1, __ATOMIC_SEQ_CST); }
-	{ char ret; ret = __atomic_add_fetch_1(vp1, v1, __ATOMIC_SEQ_CST); }
-	{ short ret; ret = __atomic_add_fetch(vp2, v2, __ATOMIC_SEQ_CST); }
-	{ short ret; ret = __atomic_add_fetch_2(vp2, v2, __ATOMIC_SEQ_CST); }
-	{ int ret; ret = __atomic_add_fetch(vp4, v4, __ATOMIC_SEQ_CST); }
-	{ int ret; ret = __atomic_add_fetch_4(vp4, v4, __ATOMIC_SEQ_CST); }
-	{ long long int ret; ret = __atomic_add_fetch(vp8, v8, __ATOMIC_SEQ_CST); }
-	{ long long int ret; ret = __atomic_add_fetch_8(vp8, v8, __ATOMIC_SEQ_CST); }
-	#if defined(__SIZEOF_INT128__)
-	{ __int128 ret; ret = __atomic_add_fetch(vp16, v16, __ATOMIC_SEQ_CST); }
-	{ __int128 ret; ret = __atomic_add_fetch_16(vp16, v16, __ATOMIC_SEQ_CST); }
-	#endif
-
-	{ char ret; ret = __atomic_sub_fetch(vp1, v1, __ATOMIC_SEQ_CST); }
-	{ char ret; ret = __atomic_sub_fetch_1(vp1, v1, __ATOMIC_SEQ_CST); }
-	{ short ret; ret = __atomic_sub_fetch(vp2, v2, __ATOMIC_SEQ_CST); }
-	{ short ret; ret = __atomic_sub_fetch_2(vp2, v2, __ATOMIC_SEQ_CST); }
-	{ int ret; ret = __atomic_sub_fetch(vp4, v4, __ATOMIC_SEQ_CST); }
-	{ int ret; ret = __atomic_sub_fetch_4(vp4, v4, __ATOMIC_SEQ_CST); }
-	{ long long int ret; ret = __atomic_sub_fetch(vp8, v8, __ATOMIC_SEQ_CST); }
-	{ long long int ret; ret = __atomic_sub_fetch_8(vp8, v8, __ATOMIC_SEQ_CST); }
-	#if defined(__SIZEOF_INT128__)
-	{ __int128 ret; ret = __atomic_sub_fetch(vp16, v16, __ATOMIC_SEQ_CST); }
-	{ __int128 ret; ret = __atomic_sub_fetch_16(vp16, v16, __ATOMIC_SEQ_CST); }
-	#endif
-
-	{ char ret; ret = __atomic_and_fetch(vp1, v1, __ATOMIC_SEQ_CST); }
-	{ char ret; ret = __atomic_and_fetch_1(vp1, v1, __ATOMIC_SEQ_CST); }
-	{ short ret; ret = __atomic_and_fetch(vp2, v2, __ATOMIC_SEQ_CST); }
-	{ short ret; ret = __atomic_and_fetch_2(vp2, v2, __ATOMIC_SEQ_CST); }
-	{ int ret; ret = __atomic_and_fetch(vp4, v4, __ATOMIC_SEQ_CST); }
-	{ int ret; ret = __atomic_and_fetch_4(vp4, v4, __ATOMIC_SEQ_CST); }
-	{ long long int ret; ret = __atomic_and_fetch(vp8, v8, __ATOMIC_SEQ_CST); }
-	{ long long int ret; ret = __atomic_and_fetch_8(vp8, v8, __ATOMIC_SEQ_CST); }
-	#if defined(__SIZEOF_INT128__)
-	{ __int128 ret; ret = __atomic_and_fetch(vp16, v16, __ATOMIC_SEQ_CST); }
-	{ __int128 ret; ret = __atomic_and_fetch_16(vp16, v16, __ATOMIC_SEQ_CST); }
-	#endif
-
-	{ char ret; ret = __atomic_nand_fetch(vp1, v1, __ATOMIC_SEQ_CST); }
-	{ char ret; ret = __atomic_nand_fetch_1(vp1, v1, __ATOMIC_SEQ_CST); }
-	{ short ret; ret = __atomic_nand_fetch(vp2, v2, __ATOMIC_SEQ_CST); }
-	{ short ret; ret = __atomic_nand_fetch_2(vp2, v2, __ATOMIC_SEQ_CST); }
-	{ int ret; ret = __atomic_nand_fetch(vp4, v4, __ATOMIC_SEQ_CST); }
-	{ int ret; ret = __atomic_nand_fetch_4(vp4, v4, __ATOMIC_SEQ_CST); }
-	{ long long int ret; ret = __atomic_nand_fetch(vp8, v8, __ATOMIC_SEQ_CST); }
-	{ long long int ret; ret = __atomic_nand_fetch_8(vp8, v8, __ATOMIC_SEQ_CST); }
-	#if defined(__SIZEOF_INT128__)
-	{ __int128 ret; ret = __atomic_nand_fetch(vp16, v16, __ATOMIC_SEQ_CST); }
-	{ __int128 ret; ret = __atomic_nand_fetch_16(vp16, v16, __ATOMIC_SEQ_CST); }
-	#endif
-
-	{ char ret; ret = __atomic_xor_fetch(vp1, v1, __ATOMIC_SEQ_CST); }
-	{ char ret; ret = __atomic_xor_fetch_1(vp1, v1, __ATOMIC_SEQ_CST); }
-	{ short ret; ret = __atomic_xor_fetch(vp2, v2, __ATOMIC_SEQ_CST); }
-	{ short ret; ret = __atomic_xor_fetch_2(vp2, v2, __ATOMIC_SEQ_CST); }
-	{ int ret; ret = __atomic_xor_fetch(vp4, v4, __ATOMIC_SEQ_CST); }
-	{ int ret; ret = __atomic_xor_fetch_4(vp4, v4, __ATOMIC_SEQ_CST); }
-	{ long long int ret; ret = __atomic_xor_fetch(vp8, v8, __ATOMIC_SEQ_CST); }
-	{ long long int ret; ret = __atomic_xor_fetch_8(vp8, v8, __ATOMIC_SEQ_CST); }
-	#if defined(__SIZEOF_INT128__)
-	{ __int128 ret; ret = __atomic_xor_fetch(vp16, v16, __ATOMIC_SEQ_CST); }
-	{ __int128 ret; ret = __atomic_xor_fetch_16(vp16, v16, __ATOMIC_SEQ_CST); }
-	#endif
-
-	{ char ret; ret = __atomic_or_fetch(vp1, v1, __ATOMIC_SEQ_CST); }
-	{ char ret; ret = __atomic_or_fetch_1(vp1, v1, __ATOMIC_SEQ_CST); }
-	{ short ret; ret = __atomic_or_fetch(vp2, v2, __ATOMIC_SEQ_CST); }
-	{ short ret; ret = __atomic_or_fetch_2(vp2, v2, __ATOMIC_SEQ_CST); }
-	{ int ret; ret = __atomic_or_fetch(vp4, v4, __ATOMIC_SEQ_CST); }
-	{ int ret; ret = __atomic_or_fetch_4(vp4, v4, __ATOMIC_SEQ_CST); }
-	{ long long int ret; ret = __atomic_or_fetch(vp8, v8, __ATOMIC_SEQ_CST); }
-	{ long long int ret; ret = __atomic_or_fetch_8(vp8, v8, __ATOMIC_SEQ_CST); }
-	#if defined(__SIZEOF_INT128__)
-	{ __int128 ret; ret = __atomic_or_fetch(vp16, v16, __ATOMIC_SEQ_CST); }
-	{ __int128 ret; ret = __atomic_or_fetch_16(vp16, v16, __ATOMIC_SEQ_CST); }
-	#endif
-
-	{ char ret; ret = __atomic_fetch_add(vp1, v1, __ATOMIC_SEQ_CST); }
-	{ char ret; ret = __atomic_fetch_add_1(vp1, v1, __ATOMIC_SEQ_CST); }
-	{ short ret; ret = __atomic_fetch_add(vp2, v2, __ATOMIC_SEQ_CST); }
-	{ short ret; ret = __atomic_fetch_add_2(vp2, v2, __ATOMIC_SEQ_CST); }
-	{ int ret; ret = __atomic_fetch_add(vp4, v4, __ATOMIC_SEQ_CST); }
-	{ int ret; ret = __atomic_fetch_add_4(vp4, v4, __ATOMIC_SEQ_CST); }
-	{ long long int ret; ret = __atomic_fetch_add(vp8, v8, __ATOMIC_SEQ_CST); }
-	{ long long int ret; ret = __atomic_fetch_add_8(vp8, v8, __ATOMIC_SEQ_CST); }
-	#if defined(__SIZEOF_INT128__)
-	{ __int128 ret; ret = __atomic_fetch_add(vp16, v16, __ATOMIC_SEQ_CST); }
-	{ __int128 ret; ret = __atomic_fetch_add_16(vp16, v16, __ATOMIC_SEQ_CST); }
-	#endif
-
-	{ char ret; ret = __atomic_fetch_sub(vp1, v1, __ATOMIC_SEQ_CST); }
-	{ char ret; ret = __atomic_fetch_sub_1(vp1, v1, __ATOMIC_SEQ_CST); }
-	{ short ret; ret = __atomic_fetch_sub(vp2, v2, __ATOMIC_SEQ_CST); }
-	{ short ret; ret = __atomic_fetch_sub_2(vp2, v2, __ATOMIC_SEQ_CST); }
-	{ int ret; ret = __atomic_fetch_sub(vp4, v4, __ATOMIC_SEQ_CST); }
-	{ int ret; ret = __atomic_fetch_sub_4(vp4, v4, __ATOMIC_SEQ_CST); }
-	{ long long int ret; ret = __atomic_fetch_sub(vp8, v8, __ATOMIC_SEQ_CST); }
-	{ long long int ret; ret = __atomic_fetch_sub_8(vp8, v8, __ATOMIC_SEQ_CST); }
-	#if defined(__SIZEOF_INT128__)
-	{ __int128 ret; ret = __atomic_fetch_sub(vp16, v16, __ATOMIC_SEQ_CST); }
-	{ __int128 ret; ret = __atomic_fetch_sub_16(vp16, v16, __ATOMIC_SEQ_CST); }
-	#endif
-
-	{ char ret; ret = __atomic_fetch_and(vp1, v1, __ATOMIC_SEQ_CST); }
-	{ char ret; ret = __atomic_fetch_and_1(vp1, v1, __ATOMIC_SEQ_CST); }
-	{ short ret; ret = __atomic_fetch_and(vp2, v2, __ATOMIC_SEQ_CST); }
-	{ short ret; ret = __atomic_fetch_and_2(vp2, v2, __ATOMIC_SEQ_CST); }
-	{ int ret; ret = __atomic_fetch_and(vp4, v4, __ATOMIC_SEQ_CST); }
-	{ int ret; ret = __atomic_fetch_and_4(vp4, v4, __ATOMIC_SEQ_CST); }
-	{ long long int ret; ret = __atomic_fetch_and(vp8, v8, __ATOMIC_SEQ_CST); }
-	{ long long int ret; ret = __atomic_fetch_and_8(vp8, v8, __ATOMIC_SEQ_CST); }
-	#if defined(__SIZEOF_INT128__)
-	{ __int128 ret; ret = __atomic_fetch_and(vp16, v16, __ATOMIC_SEQ_CST); }
-	{ __int128 ret; ret = __atomic_fetch_and_16(vp16, v16, __ATOMIC_SEQ_CST); }
-	#endif
-
-	{ char ret; ret = __atomic_fetch_nand(vp1, v1, __ATOMIC_SEQ_CST); }
-	{ char ret; ret = __atomic_fetch_nand_1(vp1, v1, __ATOMIC_SEQ_CST); }
-	{ short ret; ret = __atomic_fetch_nand(vp2, v2, __ATOMIC_SEQ_CST); }
-	{ short ret; ret = __atomic_fetch_nand_2(vp2, v2, __ATOMIC_SEQ_CST); }
-	{ int ret; ret = __atomic_fetch_nand(vp4, v4, __ATOMIC_SEQ_CST); }
-	{ int ret; ret = __atomic_fetch_nand_4(vp4, v4, __ATOMIC_SEQ_CST); }
-	{ long long int ret; ret = __atomic_fetch_nand(vp8, v8, __ATOMIC_SEQ_CST); }
-	{ long long int ret; ret = __atomic_fetch_nand_8(vp8, v8, __ATOMIC_SEQ_CST); }
-	#if defined(__SIZEOF_INT128__)
-	{ __int128 ret; ret = __atomic_fetch_nand(vp16, v16, __ATOMIC_SEQ_CST); }
-	{ __int128 ret; ret = __atomic_fetch_nand_16(vp16, v16, __ATOMIC_SEQ_CST); }
-	#endif
-
-	{ char ret; ret = __atomic_fetch_xor(vp1, v1, __ATOMIC_SEQ_CST); }
-	{ char ret; ret = __atomic_fetch_xor_1(vp1, v1, __ATOMIC_SEQ_CST); }
-	{ short ret; ret = __atomic_fetch_xor(vp2, v2, __ATOMIC_SEQ_CST); }
-	{ short ret; ret = __atomic_fetch_xor_2(vp2, v2, __ATOMIC_SEQ_CST); }
-	{ int ret; ret = __atomic_fetch_xor(vp4, v4, __ATOMIC_SEQ_CST); }
-	{ int ret; ret = __atomic_fetch_xor_4(vp4, v4, __ATOMIC_SEQ_CST); }
-	{ long long int ret; ret = __atomic_fetch_xor(vp8, v8, __ATOMIC_SEQ_CST); }
-	{ long long int ret; ret = __atomic_fetch_xor_8(vp8, v8, __ATOMIC_SEQ_CST); }
-	#if defined(__SIZEOF_INT128__)
-	{ __int128 ret; ret = __atomic_fetch_xor(vp16, v16, __ATOMIC_SEQ_CST); }
-	{ __int128 ret; ret = __atomic_fetch_xor_16(vp16, v16, __ATOMIC_SEQ_CST); }
-	#endif
-
-	{ char ret; ret = __atomic_fetch_or(vp1, v1, __ATOMIC_SEQ_CST); }
-	{ char ret; ret = __atomic_fetch_or_1(vp1, v1, __ATOMIC_SEQ_CST); }
-	{ short ret; ret = __atomic_fetch_or(vp2, v2, __ATOMIC_SEQ_CST); }
-	{ short ret; ret = __atomic_fetch_or_2(vp2, v2, __ATOMIC_SEQ_CST); }
-	{ int ret; ret = __atomic_fetch_or(vp4, v4, __ATOMIC_SEQ_CST); }
-	{ int ret; ret = __atomic_fetch_or_4(vp4, v4, __ATOMIC_SEQ_CST); }
-	{ long long int ret; ret = __atomic_fetch_or(vp8, v8, __ATOMIC_SEQ_CST); }
-	{ long long int ret; ret = __atomic_fetch_or_8(vp8, v8, __ATOMIC_SEQ_CST); }
-	#if defined(__SIZEOF_INT128__)
-	{ __int128 ret; ret = __atomic_fetch_or(vp16, v16, __ATOMIC_SEQ_CST); }
-	{ __int128 ret; ret = __atomic_fetch_or_16(vp16, v16, __ATOMIC_SEQ_CST); }
-	#endif
-
-	{ _Bool ret; ret = __atomic_always_lock_free(sizeof(int), vp4); }
-	{ _Bool ret; ret = __atomic_is_lock_free(sizeof(int), vp4); }
-	{ __atomic_thread_fence(__ATOMIC_SEQ_CST); }
-	{ __atomic_signal_fence(__ATOMIC_SEQ_CST); }
-}
-
-int main() {
-	return 0;
-}
Index: tests/builtins/sync.cfa
===================================================================
--- tests/builtins/sync.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
+++ tests/builtins/sync.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
@@ -0,0 +1,468 @@
+#include <stdbool.h>
+#include <stdint.h>
+
+void foo() {
+	volatile _Bool * vpB = 0; _Bool vB = 0;
+	volatile char * vp1 = 0; char * rp1 = 0; char v1 = 0;
+	volatile short * vp2 = 0; short * rp2 = 0; short v2 = 0;
+	volatile int * vp4 = 0; int * rp4 = 0; int v4 = 0;
+	volatile long long int * vp8 = 0; long long int * rp8 = 0; long long int v8 = 0;
+	#if defined(__SIZEOF_INT128__)
+	volatile __int128 * vp16 = 0; __int128 * rp16 = 0; __int128 v16 = 0;
+	#endif
+
+	{ char ret; ret = __sync_fetch_and_add(vp1, v1); }
+	{ char ret; ret = __sync_fetch_and_add_1(vp1, v1); }
+	{ short ret; ret = __sync_fetch_and_add(vp2, v2); }
+	{ short ret; ret = __sync_fetch_and_add_2(vp2, v2); }
+	{ int ret; ret = __sync_fetch_and_add(vp4, v4); }
+	{ int ret; ret = __sync_fetch_and_add_4(vp4, v4); }
+	{ long long int ret; ret = __sync_fetch_and_add(vp8, v8); }
+	{ long long int ret; ret = __sync_fetch_and_add_8(vp8, v8); }
+	#if defined(__SIZEOF_INT128__)
+	{ __int128 ret; ret = __sync_fetch_and_add(vp16, v16); }
+	{ __int128 ret; ret = __sync_fetch_and_add_16(vp16, v16); }
+	#endif
+
+	{ char ret; ret = __sync_fetch_and_sub(vp1, v1); }
+	{ char ret; ret = __sync_fetch_and_sub_1(vp1, v1); }
+	{ short ret; ret = __sync_fetch_and_sub(vp2, v2); }
+	{ short ret; ret = __sync_fetch_and_sub_2(vp2, v2); }
+	{ int ret; ret = __sync_fetch_and_sub(vp4, v4); }
+	{ int ret; ret = __sync_fetch_and_sub_4(vp4, v4); }
+	{ long long int ret; ret = __sync_fetch_and_sub(vp8, v8); }
+	{ long long int ret; ret = __sync_fetch_and_sub_8(vp8, v8); }
+	#if defined(__SIZEOF_INT128__)
+	{ __int128 ret; ret = __sync_fetch_and_sub(vp16, v16); }
+	{ __int128 ret; ret = __sync_fetch_and_sub_16(vp16, v16); }
+	#endif
+
+	{ char ret; ret = __sync_fetch_and_or(vp1, v1); }
+	{ char ret; ret = __sync_fetch_and_or_1(vp1, v1); }
+	{ short ret; ret = __sync_fetch_and_or(vp2, v2); }
+	{ short ret; ret = __sync_fetch_and_or_2(vp2, v2); }
+	{ int ret; ret = __sync_fetch_and_or(vp4, v4); }
+	{ int ret; ret = __sync_fetch_and_or_4(vp4, v4); }
+	{ long long int ret; ret = __sync_fetch_and_or(vp8, v8); }
+	{ long long int ret; ret = __sync_fetch_and_or_8(vp8, v8); }
+	#if defined(__SIZEOF_INT128__)
+	{ __int128 ret; ret = __sync_fetch_and_or(vp16, v16); }
+	{ __int128 ret; ret = __sync_fetch_and_or_16(vp16, v16); }
+	#endif
+
+	{ char ret; ret = __sync_fetch_and_and(vp1, v1); }
+	{ char ret; ret = __sync_fetch_and_and_1(vp1, v1); }
+	{ short ret; ret = __sync_fetch_and_and(vp2, v2); }
+	{ short ret; ret = __sync_fetch_and_and_2(vp2, v2); }
+	{ int ret; ret = __sync_fetch_and_and(vp4, v4); }
+	{ int ret; ret = __sync_fetch_and_and_4(vp4, v4); }
+	{ long long int ret; ret = __sync_fetch_and_and(vp8, v8); }
+	{ long long int ret; ret = __sync_fetch_and_and_8(vp8, v8); }
+	#if defined(__SIZEOF_INT128__)
+	{ __int128 ret; ret = __sync_fetch_and_and(vp16, v16); }
+	{ __int128 ret; ret = __sync_fetch_and_and_16(vp16, v16); }
+	#endif
+
+	{ char ret; ret = __sync_fetch_and_xor(vp1, v1); }
+	{ char ret; ret = __sync_fetch_and_xor_1(vp1, v1); }
+	{ short ret; ret = __sync_fetch_and_xor(vp2, v2); }
+	{ short ret; ret = __sync_fetch_and_xor_2(vp2, v2); }
+	{ int ret; ret = __sync_fetch_and_xor(vp4, v4); }
+	{ int ret; ret = __sync_fetch_and_xor_4(vp4, v4); }
+	{ long long int ret; ret = __sync_fetch_and_xor(vp8, v8); }
+	{ long long int ret; ret = __sync_fetch_and_xor_8(vp8, v8); }
+	#if defined(__SIZEOF_INT128__)
+	{ __int128 ret; ret = __sync_fetch_and_xor(vp16, v16); }
+	{ __int128 ret; ret = __sync_fetch_and_xor_16(vp16, v16); }
+	#endif
+
+	{ char ret; ret = __sync_fetch_and_nand(vp1, v1); }
+	{ char ret; ret = __sync_fetch_and_nand_1(vp1, v1); }
+	{ short ret; ret = __sync_fetch_and_nand(vp2, v2); }
+	{ short ret; ret = __sync_fetch_and_nand_2(vp2, v2); }
+	{ int ret; ret = __sync_fetch_and_nand(vp4, v4); }
+	{ int ret; ret = __sync_fetch_and_nand_4(vp4, v4); }
+	{ long long int ret; ret = __sync_fetch_and_nand(vp8, v8); }
+	{ long long int ret; ret = __sync_fetch_and_nand_8(vp8, v8); }
+	#if defined(__SIZEOF_INT128__)
+	{ __int128 ret; ret = __sync_fetch_and_nand(vp16, v16); }
+	{ __int128 ret; ret = __sync_fetch_and_nand_16(vp16, v16); }
+	#endif
+
+	{ char ret; ret = __sync_add_and_fetch(vp1, v1); }
+	{ char ret; ret = __sync_add_and_fetch_1(vp1, v1); }
+	{ short ret; ret = __sync_add_and_fetch(vp2, v2); }
+	{ short ret; ret = __sync_add_and_fetch_2(vp2, v2); }
+	{ int ret; ret = __sync_add_and_fetch(vp4, v4); }
+	{ int ret; ret = __sync_add_and_fetch_4(vp4, v4); }
+	{ long long int ret; ret = __sync_add_and_fetch(vp8, v8); }
+	{ long long int ret; ret = __sync_add_and_fetch_8(vp8, v8); }
+	#if defined(__SIZEOF_INT128__)
+	{ __int128 ret; ret = __sync_add_and_fetch(vp16, v16); }
+	{ __int128 ret; ret = __sync_add_and_fetch_16(vp16, v16); }
+	#endif
+
+	{ char ret; ret = __sync_sub_and_fetch(vp1, v1); }
+	{ char ret; ret = __sync_sub_and_fetch_1(vp1, v1); }
+	{ short ret; ret = __sync_sub_and_fetch(vp2, v2); }
+	{ short ret; ret = __sync_sub_and_fetch_2(vp2, v2); }
+	{ int ret; ret = __sync_sub_and_fetch(vp4, v4); }
+	{ int ret; ret = __sync_sub_and_fetch_4(vp4, v4); }
+	{ long long int ret; ret = __sync_sub_and_fetch(vp8, v8); }
+	{ long long int ret; ret = __sync_sub_and_fetch_8(vp8, v8); }
+	#if defined(__SIZEOF_INT128__)
+	{ __int128 ret; ret = __sync_sub_and_fetch(vp16, v16); }
+	{ __int128 ret; ret = __sync_sub_and_fetch_16(vp16, v16); }
+	#endif
+
+	{ char ret; ret = __sync_or_and_fetch(vp1, v1); }
+	{ char ret; ret = __sync_or_and_fetch_1(vp1, v1); }
+	{ short ret; ret = __sync_or_and_fetch(vp2, v2); }
+	{ short ret; ret = __sync_or_and_fetch_2(vp2, v2); }
+	{ int ret; ret = __sync_or_and_fetch(vp4, v4); }
+	{ int ret; ret = __sync_or_and_fetch_4(vp4, v4); }
+	{ long long int ret; ret = __sync_or_and_fetch(vp8, v8); }
+	{ long long int ret; ret = __sync_or_and_fetch_8(vp8, v8); }
+	#if defined(__SIZEOF_INT128__)
+	{ __int128 ret; ret = __sync_or_and_fetch(vp16, v16); }
+	{ __int128 ret; ret = __sync_or_and_fetch_16(vp16, v16); }
+	#endif
+
+	{ char ret; ret = __sync_and_and_fetch(vp1, v1); }
+	{ char ret; ret = __sync_and_and_fetch_1(vp1, v1); }
+	{ short ret; ret = __sync_and_and_fetch(vp2, v2); }
+	{ short ret; ret = __sync_and_and_fetch_2(vp2, v2); }
+	{ int ret; ret = __sync_and_and_fetch(vp4, v4); }
+	{ int ret; ret = __sync_and_and_fetch_4(vp4, v4); }
+	{ long long int ret; ret = __sync_and_and_fetch(vp8, v8); }
+	{ long long int ret; ret = __sync_and_and_fetch_8(vp8, v8); }
+	#if defined(__SIZEOF_INT128__)
+	{ __int128 ret; ret = __sync_and_and_fetch(vp16, v16); }
+	{ __int128 ret; ret = __sync_and_and_fetch_16(vp16, v16); }
+	#endif
+
+	{ char ret; ret = __sync_xor_and_fetch(vp1, v1); }
+	{ char ret; ret = __sync_xor_and_fetch_1(vp1, v1); }
+	{ short ret; ret = __sync_xor_and_fetch(vp2, v2); }
+	{ short ret; ret = __sync_xor_and_fetch_2(vp2, v2); }
+	{ int ret; ret = __sync_xor_and_fetch(vp4, v4); }
+	{ int ret; ret = __sync_xor_and_fetch_4(vp4, v4); }
+	{ long long int ret; ret = __sync_xor_and_fetch(vp8, v8); }
+	{ long long int ret; ret = __sync_xor_and_fetch_8(vp8, v8); }
+	#if defined(__SIZEOF_INT128__)
+	{ __int128 ret; ret = __sync_xor_and_fetch(vp16, v16); }
+	{ __int128 ret; ret = __sync_xor_and_fetch_16(vp16, v16); }
+	#endif
+
+	{ char ret; ret = __sync_nand_and_fetch(vp1, v1); }
+	{ char ret; ret = __sync_nand_and_fetch_1(vp1, v1); }
+	{ short ret; ret = __sync_nand_and_fetch(vp2, v2); }
+	{ short ret; ret = __sync_nand_and_fetch_2(vp2, v2); }
+	{ int ret; ret = __sync_nand_and_fetch(vp4, v4); }
+	{ int ret; ret = __sync_nand_and_fetch_4(vp4, v4); }
+	{ long long int ret; ret = __sync_nand_and_fetch(vp8, v8); }
+	{ long long int ret; ret = __sync_nand_and_fetch_8(vp8, v8); }
+	#if defined(__SIZEOF_INT128__)
+	{ __int128 ret; ret = __sync_nand_and_fetch(vp16, v16); }
+	{ __int128 ret; ret = __sync_nand_and_fetch_16(vp16, v16); }
+	#endif
+
+	{ _Bool ret; ret = __sync_bool_compare_and_swap(vp1, v1, v1); }
+	{ _Bool ret; ret = __sync_bool_compare_and_swap_1(vp1, v1, v1); }
+	{ _Bool ret; ret = __sync_bool_compare_and_swap(vp2, v2, v2); }
+	{ _Bool ret; ret = __sync_bool_compare_and_swap_2(vp2, v2, v2); }
+	{ _Bool ret; ret = __sync_bool_compare_and_swap(vp4, v4, v4); }
+	{ _Bool ret; ret = __sync_bool_compare_and_swap_4(vp4, v4, v4); }
+	{ _Bool ret; ret = __sync_bool_compare_and_swap(vp8, v8, v8); }
+	{ _Bool ret; ret = __sync_bool_compare_and_swap_8(vp8, v8, v8); }
+	#if defined(__SIZEOF_INT128__)
+	{ _Bool ret; ret = __sync_bool_compare_and_swap(vp16, v16, v16); }
+	{ _Bool ret; ret = __sync_bool_compare_and_swap_16(vp16, v16,v16); }
+	#endif
+
+	{ char ret; ret = __sync_val_compare_and_swap(vp1, v1, v1); }
+	{ char ret; ret = __sync_val_compare_and_swap_1(vp1, v1, v1); }
+	{ short ret; ret = __sync_val_compare_and_swap(vp2, v2, v2); }
+	{ short ret; ret = __sync_val_compare_and_swap_2(vp2, v2, v2); }
+	{ int ret; ret = __sync_val_compare_and_swap(vp4, v4, v4); }
+	{ int ret; ret = __sync_val_compare_and_swap_4(vp4, v4, v4); }
+	{ long long int ret; ret = __sync_val_compare_and_swap(vp8, v8, v8); }
+	{ long long int ret; ret = __sync_val_compare_and_swap_8(vp8, v8, v8); }
+	#if defined(__SIZEOF_INT128__)
+	{ __int128 ret; ret = __sync_val_compare_and_swap(vp16, v16, v16); }
+	{ __int128 ret; ret = __sync_val_compare_and_swap_16(vp16, v16,v16); }
+	#endif
+
+	{ char ret; ret = __sync_lock_test_and_set(vp1, v1); }
+	{ char ret; ret = __sync_lock_test_and_set_1(vp1, v1); }
+	{ short ret; ret = __sync_lock_test_and_set(vp2, v2); }
+	{ short ret; ret = __sync_lock_test_and_set_2(vp2, v2); }
+	{ int ret; ret = __sync_lock_test_and_set(vp4, v4); }
+	{ int ret; ret = __sync_lock_test_and_set_4(vp4, v4); }
+	{ long long int ret; ret = __sync_lock_test_and_set(vp8, v8); }
+	{ long long int ret; ret = __sync_lock_test_and_set_8(vp8, v8); }
+	#if defined(__SIZEOF_INT128__)
+	{ __int128 ret; ret = __sync_lock_test_and_set(vp16, v16); }
+	{ __int128 ret; ret = __sync_lock_test_and_set_16(vp16, v16); }
+	#endif
+
+	{ __sync_lock_release(vp1); }
+	{ __sync_lock_release_1(vp1); }
+	{ __sync_lock_release(vp2); }
+	{ __sync_lock_release_2(vp2); }
+	{ __sync_lock_release(vp4); }
+	{ __sync_lock_release_4(vp4); }
+	{ __sync_lock_release(vp8); }
+	{ __sync_lock_release_8(vp8); }
+	#if defined(__SIZEOF_INT128__)
+	{ __sync_lock_release(vp16); }
+	{ __sync_lock_release_16(vp16); }
+	#endif
+
+	{ __sync_synchronize(); }
+
+
+
+
+	{ _Bool ret; ret = __atomic_test_and_set(vpB, vB); }
+	{ _Bool ret; ret = __atomic_test_and_set(vp1, v1); }
+	{ __atomic_clear(vpB, vB); }
+	{ __atomic_clear(vp1, v1); }
+
+	{ char ret; ret = __atomic_exchange_n(vp1, &v1, __ATOMIC_SEQ_CST); }
+	{ char ret; ret = __atomic_exchange_1(vp1, v1, __ATOMIC_SEQ_CST); }
+	{ char ret; __atomic_exchange(vp1, &v1, &ret, __ATOMIC_SEQ_CST); }
+	{ short ret; ret = __atomic_exchange_n(vp2, &v2, __ATOMIC_SEQ_CST); }
+	{ short ret; ret = __atomic_exchange_2(vp2, v2, __ATOMIC_SEQ_CST); }
+	{ short ret; __atomic_exchange(vp2, &v2, &ret, __ATOMIC_SEQ_CST); }
+	{ int ret; ret = __atomic_exchange_n(vp4, &v4, __ATOMIC_SEQ_CST); }
+	{ int ret; ret = __atomic_exchange_4(vp4, v4, __ATOMIC_SEQ_CST); }
+	{ int ret; __atomic_exchange(vp4, &v4, &ret, __ATOMIC_SEQ_CST); }
+	{ long long int ret; ret = __atomic_exchange_n(vp8, &v8, __ATOMIC_SEQ_CST); }
+	{ long long int ret; ret = __atomic_exchange_8(vp8, v8, __ATOMIC_SEQ_CST); }
+	{ long long int ret; __atomic_exchange(vp8, &v8, &ret, __ATOMIC_SEQ_CST); }
+	#if defined(__SIZEOF_INT128__)
+	{ __int128 ret; ret = __atomic_exchange_n(vp16, &v16, __ATOMIC_SEQ_CST); }
+	{ __int128 ret; ret = __atomic_exchange_16(vp16, v16, __ATOMIC_SEQ_CST); }
+	{ __int128 ret; __atomic_exchange(vp16, &v16, &ret, __ATOMIC_SEQ_CST); }
+	#endif
+
+	{ char ret; ret = __atomic_load_n(vp1, __ATOMIC_SEQ_CST); }
+	{ char ret; ret = __atomic_load_1(vp1, __ATOMIC_SEQ_CST); }
+	{ char ret; __atomic_load(vp1, &ret, __ATOMIC_SEQ_CST); }
+	{ short ret; ret = __atomic_load_n(vp2, __ATOMIC_SEQ_CST); }
+	{ short ret; ret = __atomic_load_2(vp2, __ATOMIC_SEQ_CST); }
+	{ short ret; __atomic_load(vp2, &ret, __ATOMIC_SEQ_CST); }
+	{ int ret; ret = __atomic_load_n(vp4, __ATOMIC_SEQ_CST); }
+	{ int ret; ret = __atomic_load_4(vp4, __ATOMIC_SEQ_CST); }
+	{ int ret; __atomic_load(vp4, &ret, __ATOMIC_SEQ_CST); }
+	{ long long int ret; ret = __atomic_load_n(vp8, __ATOMIC_SEQ_CST); }
+	{ long long int ret; ret = __atomic_load_8(vp8, __ATOMIC_SEQ_CST); }
+	{ long long int ret; __atomic_load(vp8, &ret, __ATOMIC_SEQ_CST); }
+	#if defined(__SIZEOF_INT128__)
+	{ __int128 ret; ret = __atomic_load_n(vp16, __ATOMIC_SEQ_CST); }
+	{ __int128 ret; ret = __atomic_load_16(vp16, __ATOMIC_SEQ_CST); }
+	{ __int128 ret; __atomic_load(vp16, &ret, __ATOMIC_SEQ_CST); }
+	#endif
+
+	{ _Bool ret; ret = __atomic_compare_exchange_n(vp1, rp1, v1, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
+	{ _Bool ret; ret = __atomic_compare_exchange_1(vp1, rp1, v1, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
+	{ _Bool ret; ret = __atomic_compare_exchange(vp1, rp1, &v1, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
+	{ _Bool ret; ret = __atomic_compare_exchange_n(vp2, rp2, v2, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
+	{ _Bool ret; ret = __atomic_compare_exchange_2(vp2, rp2, v2, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
+	{ _Bool ret; ret = __atomic_compare_exchange(vp2, rp2, &v2, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
+	{ _Bool ret; ret = __atomic_compare_exchange_n(vp4, rp4, v4, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
+	{ _Bool ret; ret = __atomic_compare_exchange_4(vp4, rp4, v4, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
+	{ _Bool ret; ret = __atomic_compare_exchange(vp4, rp4, &v4, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
+	{ _Bool ret; ret = __atomic_compare_exchange_n(vp8, rp8, v8, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
+	{ _Bool ret; ret = __atomic_compare_exchange_8(vp8, rp8, v8, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
+	{ _Bool ret; ret = __atomic_compare_exchange(vp8, rp8, &v8, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
+	#if defined(__SIZEOF_INT128__)
+	{ _Bool ret; ret = __atomic_compare_exchange_n(vp16, rp16, v16, 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
+	{ _Bool ret; ret = __atomic_compare_exchange_16(vp16, rp16, v16, 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
+	{ _Bool ret; ret = __atomic_compare_exchange(vp16, rp16, &v16, 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); }
+	#endif
+
+	{ __atomic_store_n(vp1, v1, __ATOMIC_SEQ_CST); }
+	{ __atomic_store_1(vp1, v1, __ATOMIC_SEQ_CST); }
+	{ __atomic_store(vp1, &v1, __ATOMIC_SEQ_CST); }
+	{ __atomic_store_n(vp2, v2, __ATOMIC_SEQ_CST); }
+	{ __atomic_store_2(vp2, v2, __ATOMIC_SEQ_CST); }
+	{ __atomic_store(vp2, &v2, __ATOMIC_SEQ_CST); }
+	{ __atomic_store_n(vp4, v4, __ATOMIC_SEQ_CST); }
+	{ __atomic_store_4(vp4, v4, __ATOMIC_SEQ_CST); }
+	{ __atomic_store(vp4, &v4, __ATOMIC_SEQ_CST); }
+	{ __atomic_store_n(vp8, v8, __ATOMIC_SEQ_CST); }
+	{ __atomic_store_8(vp8, v8, __ATOMIC_SEQ_CST); }
+	{ __atomic_store(vp8, &v8, __ATOMIC_SEQ_CST); }
+	#if defined(__SIZEOF_INT128__)
+	{ __atomic_store_n(vp16, v16, __ATOMIC_SEQ_CST); }
+	{ __atomic_store_16(vp16, v16, __ATOMIC_SEQ_CST); }
+	{ __atomic_store(vp16, &v16, __ATOMIC_SEQ_CST); }
+	#endif
+
+	{ char ret; ret = __atomic_add_fetch(vp1, v1, __ATOMIC_SEQ_CST); }
+	{ char ret; ret = __atomic_add_fetch_1(vp1, v1, __ATOMIC_SEQ_CST); }
+	{ short ret; ret = __atomic_add_fetch(vp2, v2, __ATOMIC_SEQ_CST); }
+	{ short ret; ret = __atomic_add_fetch_2(vp2, v2, __ATOMIC_SEQ_CST); }
+	{ int ret; ret = __atomic_add_fetch(vp4, v4, __ATOMIC_SEQ_CST); }
+	{ int ret; ret = __atomic_add_fetch_4(vp4, v4, __ATOMIC_SEQ_CST); }
+	{ long long int ret; ret = __atomic_add_fetch(vp8, v8, __ATOMIC_SEQ_CST); }
+	{ long long int ret; ret = __atomic_add_fetch_8(vp8, v8, __ATOMIC_SEQ_CST); }
+	#if defined(__SIZEOF_INT128__)
+	{ __int128 ret; ret = __atomic_add_fetch(vp16, v16, __ATOMIC_SEQ_CST); }
+	{ __int128 ret; ret = __atomic_add_fetch_16(vp16, v16, __ATOMIC_SEQ_CST); }
+	#endif
+
+	{ char ret; ret = __atomic_sub_fetch(vp1, v1, __ATOMIC_SEQ_CST); }
+	{ char ret; ret = __atomic_sub_fetch_1(vp1, v1, __ATOMIC_SEQ_CST); }
+	{ short ret; ret = __atomic_sub_fetch(vp2, v2, __ATOMIC_SEQ_CST); }
+	{ short ret; ret = __atomic_sub_fetch_2(vp2, v2, __ATOMIC_SEQ_CST); }
+	{ int ret; ret = __atomic_sub_fetch(vp4, v4, __ATOMIC_SEQ_CST); }
+	{ int ret; ret = __atomic_sub_fetch_4(vp4, v4, __ATOMIC_SEQ_CST); }
+	{ long long int ret; ret = __atomic_sub_fetch(vp8, v8, __ATOMIC_SEQ_CST); }
+	{ long long int ret; ret = __atomic_sub_fetch_8(vp8, v8, __ATOMIC_SEQ_CST); }
+	#if defined(__SIZEOF_INT128__)
+	{ __int128 ret; ret = __atomic_sub_fetch(vp16, v16, __ATOMIC_SEQ_CST); }
+	{ __int128 ret; ret = __atomic_sub_fetch_16(vp16, v16, __ATOMIC_SEQ_CST); }
+	#endif
+
+	{ char ret; ret = __atomic_and_fetch(vp1, v1, __ATOMIC_SEQ_CST); }
+	{ char ret; ret = __atomic_and_fetch_1(vp1, v1, __ATOMIC_SEQ_CST); }
+	{ short ret; ret = __atomic_and_fetch(vp2, v2, __ATOMIC_SEQ_CST); }
+	{ short ret; ret = __atomic_and_fetch_2(vp2, v2, __ATOMIC_SEQ_CST); }
+	{ int ret; ret = __atomic_and_fetch(vp4, v4, __ATOMIC_SEQ_CST); }
+	{ int ret; ret = __atomic_and_fetch_4(vp4, v4, __ATOMIC_SEQ_CST); }
+	{ long long int ret; ret = __atomic_and_fetch(vp8, v8, __ATOMIC_SEQ_CST); }
+	{ long long int ret; ret = __atomic_and_fetch_8(vp8, v8, __ATOMIC_SEQ_CST); }
+	#if defined(__SIZEOF_INT128__)
+	{ __int128 ret; ret = __atomic_and_fetch(vp16, v16, __ATOMIC_SEQ_CST); }
+	{ __int128 ret; ret = __atomic_and_fetch_16(vp16, v16, __ATOMIC_SEQ_CST); }
+	#endif
+
+	{ char ret; ret = __atomic_nand_fetch(vp1, v1, __ATOMIC_SEQ_CST); }
+	{ char ret; ret = __atomic_nand_fetch_1(vp1, v1, __ATOMIC_SEQ_CST); }
+	{ short ret; ret = __atomic_nand_fetch(vp2, v2, __ATOMIC_SEQ_CST); }
+	{ short ret; ret = __atomic_nand_fetch_2(vp2, v2, __ATOMIC_SEQ_CST); }
+	{ int ret; ret = __atomic_nand_fetch(vp4, v4, __ATOMIC_SEQ_CST); }
+	{ int ret; ret = __atomic_nand_fetch_4(vp4, v4, __ATOMIC_SEQ_CST); }
+	{ long long int ret; ret = __atomic_nand_fetch(vp8, v8, __ATOMIC_SEQ_CST); }
+	{ long long int ret; ret = __atomic_nand_fetch_8(vp8, v8, __ATOMIC_SEQ_CST); }
+	#if defined(__SIZEOF_INT128__)
+	{ __int128 ret; ret = __atomic_nand_fetch(vp16, v16, __ATOMIC_SEQ_CST); }
+	{ __int128 ret; ret = __atomic_nand_fetch_16(vp16, v16, __ATOMIC_SEQ_CST); }
+	#endif
+
+	{ char ret; ret = __atomic_xor_fetch(vp1, v1, __ATOMIC_SEQ_CST); }
+	{ char ret; ret = __atomic_xor_fetch_1(vp1, v1, __ATOMIC_SEQ_CST); }
+	{ short ret; ret = __atomic_xor_fetch(vp2, v2, __ATOMIC_SEQ_CST); }
+	{ short ret; ret = __atomic_xor_fetch_2(vp2, v2, __ATOMIC_SEQ_CST); }
+	{ int ret; ret = __atomic_xor_fetch(vp4, v4, __ATOMIC_SEQ_CST); }
+	{ int ret; ret = __atomic_xor_fetch_4(vp4, v4, __ATOMIC_SEQ_CST); }
+	{ long long int ret; ret = __atomic_xor_fetch(vp8, v8, __ATOMIC_SEQ_CST); }
+	{ long long int ret; ret = __atomic_xor_fetch_8(vp8, v8, __ATOMIC_SEQ_CST); }
+	#if defined(__SIZEOF_INT128__)
+	{ __int128 ret; ret = __atomic_xor_fetch(vp16, v16, __ATOMIC_SEQ_CST); }
+	{ __int128 ret; ret = __atomic_xor_fetch_16(vp16, v16, __ATOMIC_SEQ_CST); }
+	#endif
+
+	{ char ret; ret = __atomic_or_fetch(vp1, v1, __ATOMIC_SEQ_CST); }
+	{ char ret; ret = __atomic_or_fetch_1(vp1, v1, __ATOMIC_SEQ_CST); }
+	{ short ret; ret = __atomic_or_fetch(vp2, v2, __ATOMIC_SEQ_CST); }
+	{ short ret; ret = __atomic_or_fetch_2(vp2, v2, __ATOMIC_SEQ_CST); }
+	{ int ret; ret = __atomic_or_fetch(vp4, v4, __ATOMIC_SEQ_CST); }
+	{ int ret; ret = __atomic_or_fetch_4(vp4, v4, __ATOMIC_SEQ_CST); }
+	{ long long int ret; ret = __atomic_or_fetch(vp8, v8, __ATOMIC_SEQ_CST); }
+	{ long long int ret; ret = __atomic_or_fetch_8(vp8, v8, __ATOMIC_SEQ_CST); }
+	#if defined(__SIZEOF_INT128__)
+	{ __int128 ret; ret = __atomic_or_fetch(vp16, v16, __ATOMIC_SEQ_CST); }
+	{ __int128 ret; ret = __atomic_or_fetch_16(vp16, v16, __ATOMIC_SEQ_CST); }
+	#endif
+
+	{ char ret; ret = __atomic_fetch_add(vp1, v1, __ATOMIC_SEQ_CST); }
+	{ char ret; ret = __atomic_fetch_add_1(vp1, v1, __ATOMIC_SEQ_CST); }
+	{ short ret; ret = __atomic_fetch_add(vp2, v2, __ATOMIC_SEQ_CST); }
+	{ short ret; ret = __atomic_fetch_add_2(vp2, v2, __ATOMIC_SEQ_CST); }
+	{ int ret; ret = __atomic_fetch_add(vp4, v4, __ATOMIC_SEQ_CST); }
+	{ int ret; ret = __atomic_fetch_add_4(vp4, v4, __ATOMIC_SEQ_CST); }
+	{ long long int ret; ret = __atomic_fetch_add(vp8, v8, __ATOMIC_SEQ_CST); }
+	{ long long int ret; ret = __atomic_fetch_add_8(vp8, v8, __ATOMIC_SEQ_CST); }
+	#if defined(__SIZEOF_INT128__)
+	{ __int128 ret; ret = __atomic_fetch_add(vp16, v16, __ATOMIC_SEQ_CST); }
+	{ __int128 ret; ret = __atomic_fetch_add_16(vp16, v16, __ATOMIC_SEQ_CST); }
+	#endif
+
+	{ char ret; ret = __atomic_fetch_sub(vp1, v1, __ATOMIC_SEQ_CST); }
+	{ char ret; ret = __atomic_fetch_sub_1(vp1, v1, __ATOMIC_SEQ_CST); }
+	{ short ret; ret = __atomic_fetch_sub(vp2, v2, __ATOMIC_SEQ_CST); }
+	{ short ret; ret = __atomic_fetch_sub_2(vp2, v2, __ATOMIC_SEQ_CST); }
+	{ int ret; ret = __atomic_fetch_sub(vp4, v4, __ATOMIC_SEQ_CST); }
+	{ int ret; ret = __atomic_fetch_sub_4(vp4, v4, __ATOMIC_SEQ_CST); }
+	{ long long int ret; ret = __atomic_fetch_sub(vp8, v8, __ATOMIC_SEQ_CST); }
+	{ long long int ret; ret = __atomic_fetch_sub_8(vp8, v8, __ATOMIC_SEQ_CST); }
+	#if defined(__SIZEOF_INT128__)
+	{ __int128 ret; ret = __atomic_fetch_sub(vp16, v16, __ATOMIC_SEQ_CST); }
+	{ __int128 ret; ret = __atomic_fetch_sub_16(vp16, v16, __ATOMIC_SEQ_CST); }
+	#endif
+
+	{ char ret; ret = __atomic_fetch_and(vp1, v1, __ATOMIC_SEQ_CST); }
+	{ char ret; ret = __atomic_fetch_and_1(vp1, v1, __ATOMIC_SEQ_CST); }
+	{ short ret; ret = __atomic_fetch_and(vp2, v2, __ATOMIC_SEQ_CST); }
+	{ short ret; ret = __atomic_fetch_and_2(vp2, v2, __ATOMIC_SEQ_CST); }
+	{ int ret; ret = __atomic_fetch_and(vp4, v4, __ATOMIC_SEQ_CST); }
+	{ int ret; ret = __atomic_fetch_and_4(vp4, v4, __ATOMIC_SEQ_CST); }
+	{ long long int ret; ret = __atomic_fetch_and(vp8, v8, __ATOMIC_SEQ_CST); }
+	{ long long int ret; ret = __atomic_fetch_and_8(vp8, v8, __ATOMIC_SEQ_CST); }
+	#if defined(__SIZEOF_INT128__)
+	{ __int128 ret; ret = __atomic_fetch_and(vp16, v16, __ATOMIC_SEQ_CST); }
+	{ __int128 ret; ret = __atomic_fetch_and_16(vp16, v16, __ATOMIC_SEQ_CST); }
+	#endif
+
+	{ char ret; ret = __atomic_fetch_nand(vp1, v1, __ATOMIC_SEQ_CST); }
+	{ char ret; ret = __atomic_fetch_nand_1(vp1, v1, __ATOMIC_SEQ_CST); }
+	{ short ret; ret = __atomic_fetch_nand(vp2, v2, __ATOMIC_SEQ_CST); }
+	{ short ret; ret = __atomic_fetch_nand_2(vp2, v2, __ATOMIC_SEQ_CST); }
+	{ int ret; ret = __atomic_fetch_nand(vp4, v4, __ATOMIC_SEQ_CST); }
+	{ int ret; ret = __atomic_fetch_nand_4(vp4, v4, __ATOMIC_SEQ_CST); }
+	{ long long int ret; ret = __atomic_fetch_nand(vp8, v8, __ATOMIC_SEQ_CST); }
+	{ long long int ret; ret = __atomic_fetch_nand_8(vp8, v8, __ATOMIC_SEQ_CST); }
+	#if defined(__SIZEOF_INT128__)
+	{ __int128 ret; ret = __atomic_fetch_nand(vp16, v16, __ATOMIC_SEQ_CST); }
+	{ __int128 ret; ret = __atomic_fetch_nand_16(vp16, v16, __ATOMIC_SEQ_CST); }
+	#endif
+
+	{ char ret; ret = __atomic_fetch_xor(vp1, v1, __ATOMIC_SEQ_CST); }
+	{ char ret; ret = __atomic_fetch_xor_1(vp1, v1, __ATOMIC_SEQ_CST); }
+	{ short ret; ret = __atomic_fetch_xor(vp2, v2, __ATOMIC_SEQ_CST); }
+	{ short ret; ret = __atomic_fetch_xor_2(vp2, v2, __ATOMIC_SEQ_CST); }
+	{ int ret; ret = __atomic_fetch_xor(vp4, v4, __ATOMIC_SEQ_CST); }
+	{ int ret; ret = __atomic_fetch_xor_4(vp4, v4, __ATOMIC_SEQ_CST); }
+	{ long long int ret; ret = __atomic_fetch_xor(vp8, v8, __ATOMIC_SEQ_CST); }
+	{ long long int ret; ret = __atomic_fetch_xor_8(vp8, v8, __ATOMIC_SEQ_CST); }
+	#if defined(__SIZEOF_INT128__)
+	{ __int128 ret; ret = __atomic_fetch_xor(vp16, v16, __ATOMIC_SEQ_CST); }
+	{ __int128 ret; ret = __atomic_fetch_xor_16(vp16, v16, __ATOMIC_SEQ_CST); }
+	#endif
+
+	{ char ret; ret = __atomic_fetch_or(vp1, v1, __ATOMIC_SEQ_CST); }
+	{ char ret; ret = __atomic_fetch_or_1(vp1, v1, __ATOMIC_SEQ_CST); }
+	{ short ret; ret = __atomic_fetch_or(vp2, v2, __ATOMIC_SEQ_CST); }
+	{ short ret; ret = __atomic_fetch_or_2(vp2, v2, __ATOMIC_SEQ_CST); }
+	{ int ret; ret = __atomic_fetch_or(vp4, v4, __ATOMIC_SEQ_CST); }
+	{ int ret; ret = __atomic_fetch_or_4(vp4, v4, __ATOMIC_SEQ_CST); }
+	{ long long int ret; ret = __atomic_fetch_or(vp8, v8, __ATOMIC_SEQ_CST); }
+	{ long long int ret; ret = __atomic_fetch_or_8(vp8, v8, __ATOMIC_SEQ_CST); }
+	#if defined(__SIZEOF_INT128__)
+	{ __int128 ret; ret = __atomic_fetch_or(vp16, v16, __ATOMIC_SEQ_CST); }
+	{ __int128 ret; ret = __atomic_fetch_or_16(vp16, v16, __ATOMIC_SEQ_CST); }
+	#endif
+
+	{ _Bool ret; ret = __atomic_always_lock_free(sizeof(int), vp4); }
+	{ _Bool ret; ret = __atomic_is_lock_free(sizeof(int), vp4); }
+	{ __atomic_thread_fence(__ATOMIC_SEQ_CST); }
+	{ __atomic_signal_fence(__ATOMIC_SEQ_CST); }
+}
+
+int main() {
+	return 0;
+}
Index: tests/concurrent/coroutineYield.c
===================================================================
--- tests/concurrent/coroutineYield.c	(revision d5b2ac82c5d162b3f54cf7db3bdcbb3a48149204)
+++ 	(revision )
@@ -1,53 +1,0 @@
-#include <fstream.hfa>
-#include <kernel.hfa>
-#include <stdlib.hfa>
-#include <thread.hfa>
-#include <time.hfa>
-
-#define __kick_rate 150000ul
-#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 = 600_000ul;
-#else
-static const unsigned long N = 1_000ul;
-#endif
-
-coroutine Coroutine {};
-
-void main(Coroutine& this) {
-	while(true) {
-		#if !defined(TEST_FOREVER)
-			sout | "Coroutine 1";
-		#endif
-		yield();
-		#if !defined(TEST_FOREVER)
-			sout | "Coroutine 2";
-		#endif
-		suspend();
-	}
-}
-
-
-int main(int argc, char* argv[]) {
-	Coroutine c;
-	for(int i = 0; TEST(i < N); i++) {
-		#if !defined(TEST_FOREVER)
-			sout | "Thread 1";
-		#endif
-		resume(c);
-		#if !defined(TEST_FOREVER)
-			sout | "Thread 2";
-		#endif
-		yield();
-		KICK_WATCHDOG;
-	}
-}
Index: tests/concurrent/coroutineYield.cfa
===================================================================
--- tests/concurrent/coroutineYield.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
+++ tests/concurrent/coroutineYield.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
@@ -0,0 +1,53 @@
+#include <fstream.hfa>
+#include <kernel.hfa>
+#include <stdlib.hfa>
+#include <thread.hfa>
+#include <time.hfa>
+
+#define __kick_rate 150000ul
+#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 = 600_000ul;
+#else
+static const unsigned long N = 1_000ul;
+#endif
+
+coroutine Coroutine {};
+
+void main(Coroutine& this) {
+	while(true) {
+		#if !defined(TEST_FOREVER)
+			sout | "Coroutine 1";
+		#endif
+		yield();
+		#if !defined(TEST_FOREVER)
+			sout | "Coroutine 2";
+		#endif
+		suspend();
+	}
+}
+
+
+int main(int argc, char* argv[]) {
+	Coroutine c;
+	for(int i = 0; TEST(i < N); i++) {
+		#if !defined(TEST_FOREVER)
+			sout | "Thread 1";
+		#endif
+		resume(c);
+		#if !defined(TEST_FOREVER)
+			sout | "Thread 2";
+		#endif
+		yield();
+		KICK_WATCHDOG;
+	}
+}
Index: tests/concurrent/examples/boundedBufferEXT.c
===================================================================
--- tests/concurrent/examples/boundedBufferEXT.c	(revision d5b2ac82c5d162b3f54cf7db3bdcbb3a48149204)
+++ 	(revision )
@@ -1,123 +1,0 @@
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-//
-// boundedBufferEXT.c --
-//
-// Author           : Peter A. Buhr
-// Created On       : Wed Apr 18 22:52:12 2018
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Tue Dec 11 21:55:02 2018
-// Update Count     : 9
-//
-
-#include <stdlib.hfa>										// random
-#include <fstream.hfa>
-#include <kernel.hfa>
-#include <thread.hfa>
-#include <unistd.h>										// getpid
-
-//Duration default_preemption() { return 0; }
-
-enum { BufferSize = 50 };
-
-forall( otype T ) {
-	monitor Buffer {
-		int front, back, count;
-		T elements[BufferSize];
-	}; // Buffer
-
-	void ?{}( Buffer(T) & buffer ) with( buffer ) { [front, back, count] = 0; }
-
-	int query( Buffer(T) & buffer ) { return buffer.count; } // read-only, no mutual exclusion
-
-	T remove( Buffer(T) & mutex buffer );				// forward
-
-	void insert( Buffer(T) & mutex buffer, T elem ) with( buffer ) {
-		if ( count == BufferSize ) waitfor( remove, buffer );
-		elements[back] = elem;
-		back = ( back + 1 ) % BufferSize;
-		count += 1;
-	} // insert
-
-	T remove( Buffer(T) & mutex buffer ) with( buffer ) {
-		if ( count == 0 ) waitfor( insert, buffer );
-		T elem = elements[front];
-		front = ( front + 1 ) % BufferSize;
-		count -= 1;
-		return elem;
-	} // remove
-}
-
-const int Sentinel = -1;
-
-thread Producer {
-	Buffer(int) & buffer;
-	unsigned int N;
-};
-void main( Producer & prod ) with( prod ) {
-	for ( int i = 1; i <= N; i += 1 ) {
-		yield( random( 5 ) );
-		insert( buffer, 1 );
-	} // for
-}
-void ?{}( Producer & prod, Buffer(int) * buffer, int N ) {
-	&prod.buffer = buffer;
-	prod.N = N;
-}
-
-thread Consumer {
-	Buffer(int) & buffer;
-	int & sum;											// summation of producer values
-};
-void main( Consumer & cons ) with( cons ) {
-	sum = 0;
-	for () {
-		yield( random( 5 ) );
-		int item = remove( buffer );
-	  if ( item == Sentinel ) break;					// sentinel ?
-		sum += item;
-	} // for
-}
-void ?{}( Consumer & cons, Buffer(int) * buffer, int & sum ) {
-	&cons.buffer = buffer;
-	&cons.sum = &sum;
-}
-
-int main() {
-	Buffer(int) buffer;
-	enum { Prods = 4, Cons = 5 };
-	Producer * prods[Prods];
-	Consumer * cons[Cons];
-	int sums[Cons];
-	int i;
-	processor p;
-
-	//srandom( getpid() );
-	srandom( 1003 );
-
-	for ( i = 0; i < Cons; i += 1 ) {					// create consumers
-		cons[i] = new( &buffer, sums[i] );
-	} // for
-	for ( i = 0; i < Prods; i += 1 ) {					// create producers
-		prods[i] = new( &buffer, 100000 );
-	} // for
-
-	for ( i = 0; i < Prods; i += 1 ) {					// wait for producers to finish
-		delete( prods[i] );
-	} // for
-	for ( i = 0; i < Cons; i += 1 ) {					// generate sentinal values to stop consumers
-		insert( buffer, Sentinel );
-	} // for
-	int sum = 0;
-	for ( i = 0; i < Cons; i += 1 ) {					// wait for consumers to finish
-		delete( cons[i] );
-		sum += sums[i];
-	} // for
-	sout | "total:" | sum;
-}
-
-// Local Variables: //
-// tab-width: 4 //
-// compile-command: "cfa boundedBufferEXT.c" //
-// End: //
Index: tests/concurrent/examples/boundedBufferEXT.cfa
===================================================================
--- tests/concurrent/examples/boundedBufferEXT.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
+++ tests/concurrent/examples/boundedBufferEXT.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
@@ -0,0 +1,123 @@
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// boundedBufferEXT.c --
+//
+// Author           : Peter A. Buhr
+// Created On       : Wed Apr 18 22:52:12 2018
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Tue Dec 11 21:55:02 2018
+// Update Count     : 9
+//
+
+#include <stdlib.hfa>										// random
+#include <fstream.hfa>
+#include <kernel.hfa>
+#include <thread.hfa>
+#include <unistd.h>										// getpid
+
+//Duration default_preemption() { return 0; }
+
+enum { BufferSize = 50 };
+
+forall( otype T ) {
+	monitor Buffer {
+		int front, back, count;
+		T elements[BufferSize];
+	}; // Buffer
+
+	void ?{}( Buffer(T) & buffer ) with( buffer ) { [front, back, count] = 0; }
+
+	int query( Buffer(T) & buffer ) { return buffer.count; } // read-only, no mutual exclusion
+
+	T remove( Buffer(T) & mutex buffer );				// forward
+
+	void insert( Buffer(T) & mutex buffer, T elem ) with( buffer ) {
+		if ( count == BufferSize ) waitfor( remove, buffer );
+		elements[back] = elem;
+		back = ( back + 1 ) % BufferSize;
+		count += 1;
+	} // insert
+
+	T remove( Buffer(T) & mutex buffer ) with( buffer ) {
+		if ( count == 0 ) waitfor( insert, buffer );
+		T elem = elements[front];
+		front = ( front + 1 ) % BufferSize;
+		count -= 1;
+		return elem;
+	} // remove
+}
+
+const int Sentinel = -1;
+
+thread Producer {
+	Buffer(int) & buffer;
+	unsigned int N;
+};
+void main( Producer & prod ) with( prod ) {
+	for ( int i = 1; i <= N; i += 1 ) {
+		yield( random( 5 ) );
+		insert( buffer, 1 );
+	} // for
+}
+void ?{}( Producer & prod, Buffer(int) * buffer, int N ) {
+	&prod.buffer = buffer;
+	prod.N = N;
+}
+
+thread Consumer {
+	Buffer(int) & buffer;
+	int & sum;											// summation of producer values
+};
+void main( Consumer & cons ) with( cons ) {
+	sum = 0;
+	for () {
+		yield( random( 5 ) );
+		int item = remove( buffer );
+	  if ( item == Sentinel ) break;					// sentinel ?
+		sum += item;
+	} // for
+}
+void ?{}( Consumer & cons, Buffer(int) * buffer, int & sum ) {
+	&cons.buffer = buffer;
+	&cons.sum = &sum;
+}
+
+int main() {
+	Buffer(int) buffer;
+	enum { Prods = 4, Cons = 5 };
+	Producer * prods[Prods];
+	Consumer * cons[Cons];
+	int sums[Cons];
+	int i;
+	processor p;
+
+	//srandom( getpid() );
+	srandom( 1003 );
+
+	for ( i = 0; i < Cons; i += 1 ) {					// create consumers
+		cons[i] = new( &buffer, sums[i] );
+	} // for
+	for ( i = 0; i < Prods; i += 1 ) {					// create producers
+		prods[i] = new( &buffer, 100000 );
+	} // for
+
+	for ( i = 0; i < Prods; i += 1 ) {					// wait for producers to finish
+		delete( prods[i] );
+	} // for
+	for ( i = 0; i < Cons; i += 1 ) {					// generate sentinal values to stop consumers
+		insert( buffer, Sentinel );
+	} // for
+	int sum = 0;
+	for ( i = 0; i < Cons; i += 1 ) {					// wait for consumers to finish
+		delete( cons[i] );
+		sum += sums[i];
+	} // for
+	sout | "total:" | sum;
+}
+
+// Local Variables: //
+// tab-width: 4 //
+// compile-command: "cfa boundedBufferEXT.c" //
+// End: //
Index: tests/concurrent/examples/boundedBufferINT.c
===================================================================
--- tests/concurrent/examples/boundedBufferINT.c	(revision d5b2ac82c5d162b3f54cf7db3bdcbb3a48149204)
+++ 	(revision )
@@ -1,124 +1,0 @@
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-//
-// boundedBuffer.c --
-//
-// Author           : Peter A. Buhr
-// Created On       : Mon Oct 30 12:45:13 2017
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Tue Dec 11 21:55:45 2018
-// Update Count     : 84
-//
-
-#include <stdlib.hfa>										// random
-#include <fstream.hfa>
-#include <kernel.hfa>
-#include <thread.hfa>
-#include <unistd.h>										// getpid
-
-//Duration default_preemption() { return 0; }
-
-enum { BufferSize = 50 };
-
-forall( otype T ) {
-	monitor Buffer {
-		condition full, empty;
-		int front, back, count;
-		T elements[BufferSize];
-	}; // Buffer
-
-	void ?{}( Buffer(T) & buffer ) with( buffer ) { [front, back, count] = 0; }
-
-	int query( Buffer(T) & buffer ) { return buffer.count; } // read-only, no mutual exclusion
-
-	void insert( Buffer(T) & mutex buffer, T elem ) with( buffer ) {
-		if ( count == BufferSize ) wait( empty );
-		elements[back] = elem;
-		back = ( back + 1 ) % BufferSize;
-		count += 1;
-		signal( full );
-	} // insert
-
-	T remove( Buffer(T) & mutex buffer ) with( buffer ) {
-		if ( count == 0 ) wait( full );
-		T elem = elements[front];
-		front = ( front + 1 ) % BufferSize;
-		count -= 1;
-		signal( empty );
-		return elem;
-	} // remove
-}
-
-const int Sentinel = -1;
-
-thread Producer {
-	Buffer(int) & buffer;
-	unsigned int N;
-};
-void main( Producer & prod ) with( prod ) {
-	for ( int i = 1; i <= N; i += 1 ) {
-		yield( random( 5 ) );
-		insert( buffer, 1 );
-	} // for
-}
-void ?{}( Producer & prod, Buffer(int) * buffer, int N ) {
-	&prod.buffer = buffer;
-	prod.N = N;
-}
-
-thread Consumer {
-	Buffer(int) & buffer;
-	int & sum;											// summation of producer values
-};
-void main( Consumer & cons ) with( cons ) {
-	sum = 0;
-	for () {
-		yield( random( 5 ) );
-		int item = remove( buffer );
-	  if ( item == Sentinel ) break;					// sentinel ?
-		sum += item;
-	} // for
-}
-void ?{}( Consumer & cons, Buffer(int) * buffer, int & sum ) {
-	&cons.buffer = buffer;
-	&cons.sum = &sum;
-}
-
-int main() {
-	Buffer(int) buffer;
-	enum { Prods = 4, Cons = 5 };
-	Producer * prods[Prods];
-	Consumer * cons[Cons];
-	int sums[Cons];
-	int i;
-	processor p;
-
-	//srandom( getpid() );
-	srandom( 1003 );
-
-	for ( i = 0; i < Cons; i += 1 ) {					// create consumers
-		cons[i] = new( &buffer, sums[i] );
-	} // for
-	for ( i = 0; i < Prods; i += 1 ) {					// create producers
-		prods[i] = new( &buffer, 100000 );
-	} // for
-
-	for ( i = 0; i < Prods; i += 1 ) {					// wait for producers to finish
-		delete( prods[i] );
-	} // for
-	for ( i = 0; i < Cons; i += 1 ) {					// generate sentinal values to stop consumers
-		insert( buffer, Sentinel );
-	} // for
-	int sum = 0;
-	for ( i = 0; i < Cons; i += 1 ) {					// wait for consumers to finish
-		delete( cons[i] );
-		sum += sums[i];
-	} // for
-	sout | "total:" | sum;
-}
-
-// Local Variables: //
-// tab-width: 4 //
-// compile-command: "cfa boundedBufferINT.c" //
-// End: //
Index: tests/concurrent/examples/boundedBufferINT.cfa
===================================================================
--- tests/concurrent/examples/boundedBufferINT.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
+++ tests/concurrent/examples/boundedBufferINT.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
@@ -0,0 +1,124 @@
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// boundedBuffer.c --
+//
+// Author           : Peter A. Buhr
+// Created On       : Mon Oct 30 12:45:13 2017
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Tue Dec 11 21:55:45 2018
+// Update Count     : 84
+//
+
+#include <stdlib.hfa>										// random
+#include <fstream.hfa>
+#include <kernel.hfa>
+#include <thread.hfa>
+#include <unistd.h>										// getpid
+
+//Duration default_preemption() { return 0; }
+
+enum { BufferSize = 50 };
+
+forall( otype T ) {
+	monitor Buffer {
+		condition full, empty;
+		int front, back, count;
+		T elements[BufferSize];
+	}; // Buffer
+
+	void ?{}( Buffer(T) & buffer ) with( buffer ) { [front, back, count] = 0; }
+
+	int query( Buffer(T) & buffer ) { return buffer.count; } // read-only, no mutual exclusion
+
+	void insert( Buffer(T) & mutex buffer, T elem ) with( buffer ) {
+		if ( count == BufferSize ) wait( empty );
+		elements[back] = elem;
+		back = ( back + 1 ) % BufferSize;
+		count += 1;
+		signal( full );
+	} // insert
+
+	T remove( Buffer(T) & mutex buffer ) with( buffer ) {
+		if ( count == 0 ) wait( full );
+		T elem = elements[front];
+		front = ( front + 1 ) % BufferSize;
+		count -= 1;
+		signal( empty );
+		return elem;
+	} // remove
+}
+
+const int Sentinel = -1;
+
+thread Producer {
+	Buffer(int) & buffer;
+	unsigned int N;
+};
+void main( Producer & prod ) with( prod ) {
+	for ( int i = 1; i <= N; i += 1 ) {
+		yield( random( 5 ) );
+		insert( buffer, 1 );
+	} // for
+}
+void ?{}( Producer & prod, Buffer(int) * buffer, int N ) {
+	&prod.buffer = buffer;
+	prod.N = N;
+}
+
+thread Consumer {
+	Buffer(int) & buffer;
+	int & sum;											// summation of producer values
+};
+void main( Consumer & cons ) with( cons ) {
+	sum = 0;
+	for () {
+		yield( random( 5 ) );
+		int item = remove( buffer );
+	  if ( item == Sentinel ) break;					// sentinel ?
+		sum += item;
+	} // for
+}
+void ?{}( Consumer & cons, Buffer(int) * buffer, int & sum ) {
+	&cons.buffer = buffer;
+	&cons.sum = &sum;
+}
+
+int main() {
+	Buffer(int) buffer;
+	enum { Prods = 4, Cons = 5 };
+	Producer * prods[Prods];
+	Consumer * cons[Cons];
+	int sums[Cons];
+	int i;
+	processor p;
+
+	//srandom( getpid() );
+	srandom( 1003 );
+
+	for ( i = 0; i < Cons; i += 1 ) {					// create consumers
+		cons[i] = new( &buffer, sums[i] );
+	} // for
+	for ( i = 0; i < Prods; i += 1 ) {					// create producers
+		prods[i] = new( &buffer, 100000 );
+	} // for
+
+	for ( i = 0; i < Prods; i += 1 ) {					// wait for producers to finish
+		delete( prods[i] );
+	} // for
+	for ( i = 0; i < Cons; i += 1 ) {					// generate sentinal values to stop consumers
+		insert( buffer, Sentinel );
+	} // for
+	int sum = 0;
+	for ( i = 0; i < Cons; i += 1 ) {					// wait for consumers to finish
+		delete( cons[i] );
+		sum += sums[i];
+	} // for
+	sout | "total:" | sum;
+}
+
+// Local Variables: //
+// tab-width: 4 //
+// compile-command: "cfa boundedBufferINT.c" //
+// End: //
Index: tests/concurrent/examples/datingService.c
===================================================================
--- tests/concurrent/examples/datingService.c	(revision d5b2ac82c5d162b3f54cf7db3bdcbb3a48149204)
+++ 	(revision )
@@ -1,113 +1,0 @@
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-//
-// datingService.c --
-//
-// Author           : Peter A. Buhr
-// Created On       : Mon Oct 30 12:56:20 2017
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Tue Dec 11 21:55:34 2018
-// Update Count     : 28
-//
-
-#include <stdlib.hfa>										// random
-#include <fstream.hfa>
-#include <kernel.hfa>
-#include <thread.hfa>
-#include <unistd.h>										// getpid
-
-enum { CompCodes = 20 };								// number of compatibility codes
-
-monitor DatingService {
-	condition Girls[CompCodes], Boys[CompCodes];
-	unsigned int GirlPhoneNo, BoyPhoneNo;
-}; // DatingService
-
-unsigned int girl( DatingService & mutex ds, unsigned int PhoneNo, unsigned int ccode ) with( ds ) {
-	if ( is_empty( Boys[ccode] ) ) {					// no compatible boy ?
-		wait( Girls[ccode] );							// wait for boy
-		GirlPhoneNo = PhoneNo;							// make phone number available
-	} else {
-		GirlPhoneNo = PhoneNo;							// make phone number available
-		signal_block( Boys[ccode] );					// restart boy to set phone number
-	} // if
-	return BoyPhoneNo;
-} // DatingService girl
-
-unsigned int boy( DatingService & mutex ds, unsigned int PhoneNo, unsigned int ccode ) with( ds ) {
-	if ( is_empty( Girls[ccode] ) ) {					// no compatible girl ?
-		wait( Boys[ccode] );							// wait for girl
-		BoyPhoneNo = PhoneNo;							// make phone number available
-	} else {
-		BoyPhoneNo = PhoneNo;							// make phone number available
-		signal_block( Girls[ccode] );					// restart girl to set phone number
-	} // if
-	return GirlPhoneNo;
-} // DatingService boy
-
-unsigned int girlck[CompCodes];
-unsigned int boyck[CompCodes];
-
-thread Girl {
-	DatingService & TheExchange;
-	unsigned int id, ccode;
-}; // Girl
-
-void main( Girl & g ) with( g ) {
-	yield( random( 100 ) );								// don't all start at the same time
-	unsigned int partner = girl( TheExchange, id, ccode );
-	sout | "Girl:" | id | "is dating Boy at" | partner | "with ccode" | ccode;
-	girlck[id] = partner;
-} // Girl main
-
-void ?{}( Girl & g, DatingService * TheExchange, unsigned int id, unsigned int ccode ) {
-	&g.TheExchange = TheExchange;
-	g.id = id;
-	g.ccode = ccode;
-} // Girl ?{}
-
-thread Boy {
-	DatingService & TheExchange;
-	unsigned int id, ccode;
-}; // Boy
-
-void main( Boy & b ) with( b ) {
-	yield( random( 100 ) );								// don't all start at the same time
-	unsigned int partner = boy( TheExchange, id, ccode );
-	sout | " Boy:" | id | "is dating Girl" | partner | "with ccode" | ccode;
-	boyck[id] = partner;
-} // Boy main
-
-void ?{}( Boy & b, DatingService * TheExchange, unsigned int id, unsigned int ccode ) {
-	&b.TheExchange = TheExchange;
-	b.id = id;
-	b.ccode = ccode;
-} // Boy ?{}
-
-int main() {
-	DatingService TheExchange;
-	Girl * girls[CompCodes];
-	Boy  * boys[CompCodes];
-
-	srandom( /*getpid()*/ 103 );
-
-	for ( unsigned int i = 0; i < CompCodes; i += 1 ) {
-		girls[i] = new( &TheExchange, i, i );
-		boys[i]  = new( &TheExchange, i, CompCodes - ( i + 1 ) );
-	} // for
-
-	for ( unsigned int i = 0; i < CompCodes; i += 1 ) {
-		delete( boys[i] );
-		delete( girls[i] );
-	} // for
-
-	for ( unsigned int i = 0; i < CompCodes; i += 1 ) {
-		if ( girlck[ boyck[i] ] != boyck[ girlck[i] ] ) abort();
-	} // for
-} // main
-
-// Local Variables: //
-// tab-width: 4 //
-// compile-command: "cfa datingService.c" //
-// End: //
Index: tests/concurrent/examples/datingService.cfa
===================================================================
--- tests/concurrent/examples/datingService.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
+++ tests/concurrent/examples/datingService.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
@@ -0,0 +1,113 @@
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// datingService.c --
+//
+// Author           : Peter A. Buhr
+// Created On       : Mon Oct 30 12:56:20 2017
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Tue Dec 11 21:55:34 2018
+// Update Count     : 28
+//
+
+#include <stdlib.hfa>										// random
+#include <fstream.hfa>
+#include <kernel.hfa>
+#include <thread.hfa>
+#include <unistd.h>										// getpid
+
+enum { CompCodes = 20 };								// number of compatibility codes
+
+monitor DatingService {
+	condition Girls[CompCodes], Boys[CompCodes];
+	unsigned int GirlPhoneNo, BoyPhoneNo;
+}; // DatingService
+
+unsigned int girl( DatingService & mutex ds, unsigned int PhoneNo, unsigned int ccode ) with( ds ) {
+	if ( is_empty( Boys[ccode] ) ) {					// no compatible boy ?
+		wait( Girls[ccode] );							// wait for boy
+		GirlPhoneNo = PhoneNo;							// make phone number available
+	} else {
+		GirlPhoneNo = PhoneNo;							// make phone number available
+		signal_block( Boys[ccode] );					// restart boy to set phone number
+	} // if
+	return BoyPhoneNo;
+} // DatingService girl
+
+unsigned int boy( DatingService & mutex ds, unsigned int PhoneNo, unsigned int ccode ) with( ds ) {
+	if ( is_empty( Girls[ccode] ) ) {					// no compatible girl ?
+		wait( Boys[ccode] );							// wait for girl
+		BoyPhoneNo = PhoneNo;							// make phone number available
+	} else {
+		BoyPhoneNo = PhoneNo;							// make phone number available
+		signal_block( Girls[ccode] );					// restart girl to set phone number
+	} // if
+	return GirlPhoneNo;
+} // DatingService boy
+
+unsigned int girlck[CompCodes];
+unsigned int boyck[CompCodes];
+
+thread Girl {
+	DatingService & TheExchange;
+	unsigned int id, ccode;
+}; // Girl
+
+void main( Girl & g ) with( g ) {
+	yield( random( 100 ) );								// don't all start at the same time
+	unsigned int partner = girl( TheExchange, id, ccode );
+	sout | "Girl:" | id | "is dating Boy at" | partner | "with ccode" | ccode;
+	girlck[id] = partner;
+} // Girl main
+
+void ?{}( Girl & g, DatingService * TheExchange, unsigned int id, unsigned int ccode ) {
+	&g.TheExchange = TheExchange;
+	g.id = id;
+	g.ccode = ccode;
+} // Girl ?{}
+
+thread Boy {
+	DatingService & TheExchange;
+	unsigned int id, ccode;
+}; // Boy
+
+void main( Boy & b ) with( b ) {
+	yield( random( 100 ) );								// don't all start at the same time
+	unsigned int partner = boy( TheExchange, id, ccode );
+	sout | " Boy:" | id | "is dating Girl" | partner | "with ccode" | ccode;
+	boyck[id] = partner;
+} // Boy main
+
+void ?{}( Boy & b, DatingService * TheExchange, unsigned int id, unsigned int ccode ) {
+	&b.TheExchange = TheExchange;
+	b.id = id;
+	b.ccode = ccode;
+} // Boy ?{}
+
+int main() {
+	DatingService TheExchange;
+	Girl * girls[CompCodes];
+	Boy  * boys[CompCodes];
+
+	srandom( /*getpid()*/ 103 );
+
+	for ( unsigned int i = 0; i < CompCodes; i += 1 ) {
+		girls[i] = new( &TheExchange, i, i );
+		boys[i]  = new( &TheExchange, i, CompCodes - ( i + 1 ) );
+	} // for
+
+	for ( unsigned int i = 0; i < CompCodes; i += 1 ) {
+		delete( boys[i] );
+		delete( girls[i] );
+	} // for
+
+	for ( unsigned int i = 0; i < CompCodes; i += 1 ) {
+		if ( girlck[ boyck[i] ] != boyck[ girlck[i] ] ) abort();
+	} // for
+} // main
+
+// Local Variables: //
+// tab-width: 4 //
+// compile-command: "cfa datingService.c" //
+// End: //
Index: tests/concurrent/examples/matrixSum.c
===================================================================
--- tests/concurrent/examples/matrixSum.c	(revision d5b2ac82c5d162b3f54cf7db3bdcbb3a48149204)
+++ 	(revision )
@@ -1,62 +1,0 @@
-//                               -*- Mode: C -*-
-//
-// Cforall Version 1.0.0 Copyright (C) 2017 University of Waterloo
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-//
-// matrixSum.cfa --
-//
-// Author           : Peter A. Buhr
-// Created On       : Mon Oct  9 08:29:28 2017
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Tue Dec 11 21:54:55 2018
-// Update Count     : 15
-//
-
-#include <fstream.hfa>
-#include <kernel.hfa>
-#include <thread.hfa>
-
-thread Adder {
-	int * row, cols, & subtotal;						// communication
-};
-
-void ?{}( Adder & adder, int row[], int cols, int & subtotal ) {
-	adder.[ row, cols ] = [ row, cols ];				// expression disallowed in multi-member access
-	&adder.subtotal = &subtotal;
-}
-
-void main( Adder & adder ) with( adder ) {				// thread starts here
-	subtotal = 0;
-	for ( c; cols ) {
-		subtotal += row[c];
-	} // for
-}
-
-int main() {
-	/* const */ int rows = 10, cols = 1000;
-	int matrix[rows][cols], subtotals[rows], total = 0;
-	processor p;										// add kernel thread
-
-	for ( r; rows ) {
-		for ( c; cols ) {
-			matrix[r][c] = 1;
-		} // for
-	} // for
-	Adder * adders[rows];
-	for ( r; rows ) {									// start threads to sum rows
-		adders[r] = &(*malloc()){ matrix[r], cols, subtotals[r] };
-//		adders[r] = new( matrix[r], cols, &subtotals[r] );
-	} // for
-	for ( r; rows ) {									// wait for threads to finish
-		delete( adders[r] );
-		total += subtotals[r];							// total subtotals
-	} // for
-	sout | total;
-}
-
-// Local Variables: //
-// tab-width: 4 //
-// compile-command: "cfa matrixSum.cfa" //
-// End: //
Index: tests/concurrent/examples/matrixSum.cfa
===================================================================
--- tests/concurrent/examples/matrixSum.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
+++ tests/concurrent/examples/matrixSum.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
@@ -0,0 +1,62 @@
+//                               -*- Mode: C -*-
+//
+// Cforall Version 1.0.0 Copyright (C) 2017 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// matrixSum.cfa --
+//
+// Author           : Peter A. Buhr
+// Created On       : Mon Oct  9 08:29:28 2017
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Tue Dec 11 21:54:55 2018
+// Update Count     : 15
+//
+
+#include <fstream.hfa>
+#include <kernel.hfa>
+#include <thread.hfa>
+
+thread Adder {
+	int * row, cols, & subtotal;						// communication
+};
+
+void ?{}( Adder & adder, int row[], int cols, int & subtotal ) {
+	adder.[ row, cols ] = [ row, cols ];				// expression disallowed in multi-member access
+	&adder.subtotal = &subtotal;
+}
+
+void main( Adder & adder ) with( adder ) {				// thread starts here
+	subtotal = 0;
+	for ( c; cols ) {
+		subtotal += row[c];
+	} // for
+}
+
+int main() {
+	/* const */ int rows = 10, cols = 1000;
+	int matrix[rows][cols], subtotals[rows], total = 0;
+	processor p;										// add kernel thread
+
+	for ( r; rows ) {
+		for ( c; cols ) {
+			matrix[r][c] = 1;
+		} // for
+	} // for
+	Adder * adders[rows];
+	for ( r; rows ) {									// start threads to sum rows
+		adders[r] = &(*malloc()){ matrix[r], cols, subtotals[r] };
+//		adders[r] = new( matrix[r], cols, &subtotals[r] );
+	} // for
+	for ( r; rows ) {									// wait for threads to finish
+		delete( adders[r] );
+		total += subtotals[r];							// total subtotals
+	} // for
+	sout | total;
+}
+
+// Local Variables: //
+// tab-width: 4 //
+// compile-command: "cfa matrixSum.cfa" //
+// End: //
Index: tests/concurrent/examples/quickSort.c
===================================================================
--- tests/concurrent/examples/quickSort.c	(revision d5b2ac82c5d162b3f54cf7db3bdcbb3a48149204)
+++ 	(revision )
@@ -1,181 +1,0 @@
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-//
-// quickSort.c -- In-place concurrent quick-sort: threads are created to partition to a specific depth, then sequential
-//		recursive-calls are use to sort each partition.
-//
-// Author           : Peter A. Buhr
-// Created On       : Wed Dec  6 12:15:52 2017
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Sat Dec 22 08:44:27 2018
-// Update Count     : 168
-//
-
-#include <fstream.hfa>
-#include <stdlib.hfa>
-#include <kernel.hfa>
-#include <thread.hfa>
-#include <string.h>										// strcmp
-
-thread Quicksort {
-	int * values;										// communication variables
-	int low, high, depth;
-};
-
-void ?{}( Quicksort & qs, int values[], int size, int depth ) {
-	qs.values = values;  qs.low = 0;  qs.high = size;  qs.depth = depth;
-} // Quicksort
-
-void main( Quicksort & qs ) {							// thread starts here
-	// nested routines: information hiding
-
-	void ?{}( Quicksort & qs, int values[], int low, int high, int depth ) {
-		qs.values = values;  qs.low = low;  qs.high = high;  qs.depth = depth;
-	} // Quicksort
-
-	void sort( int values[], int low, int high, int depth ) {
-		int left, right;								// index to left/right-hand side of the values
-		int pivot;										// pivot value of values
-		int swap;										// temporary
-
-		//verify();										// check for stack overflow due to recursion
-
-		// partition while 2 or more elements in the array
-		if ( low < high ) {
-			pivot = values[low + ( high - low ) / 2];
-			left  = low;
-			right = high;
-
-			// partition: move values less < pivot before the pivot and values > pivot after the pivot
-			do {
-				while ( values[left] < pivot ) left += 1; // changed values[left] < pivot
-				while ( pivot < values[right] ) right -= 1;
-				if ( left <= right ) {
-					swap = values[left];				// interchange values
-					values[left]  = values[right];
-					values[right] = swap;
-					left += 1;
-					right -= 1;
-				} // if
-			} while ( left <= right );
-
-			// restrict number of tasks to slightly greater than number of processors
-			if ( depth > 0 ) {
-				depth -= 1;
-				Quicksort rqs = { values, low, right, depth }; // concurrently sort upper half
-				//Quicksort lqs( values, left, high, depth ); // concurrently sort lower half
-				sort( values, left, high, depth );		// concurrently sort lower half
-			} else {
-				sort( values, low, right, 0 );			// sequentially sort lower half
-				sort( values, left, high, 0 );			// sequentially sort upper half
-			} // if
-		} // if
-	} // sort
-
-	with( qs ) {
-		sort( values, low, high, depth );
-	} // with
-} // main
-
-
-bool convert( int & val, const char * nptr ) {			// convert C string to integer
-	char * eptr;
-	int temp = strto( nptr, &eptr, 10 );				// do not change val on false
-	// true => entire string valid with no extra characters
-	return *nptr != '\0' && *eptr == '\0' ? val = temp, true : false;
-} // convert
-
-void usage( char * argv[] ) {
-	sout | "Usage:" | argv[0] | "( -s unsorted-file [ sorted-file ] | -t size (>= 0) [ depth (>= 0) ] )";
-	exit( EXIT_FAILURE );								// TERMINATE!
-} // usage
-
-
-int main( int argc, char * argv[] ) {
-	ifstream & unsortedfile = sin;
-	ofstream & sortedfile = sout;						// default value
-	int depth = 0, size;
-
-	if ( argc != 1 ) {									// do not use defaults
-		if ( argc < 2 || argc > 4 ) usage( argv );		// wrong number of options
-		if ( strcmp( argv[1], "-t" ) == 0 ) {			// timing ?
-			&unsortedfile = (ifstream *)0;				// no input
-			choose ( argc ) {
-			  case 4:
-				if ( ! convert( depth, argv[3] ) || depth < 0 ) usage( argv );
-				fallthrough;
-			  case 3:
-				if ( ! convert( size, argv[2] ) || size < 0 ) usage( argv );
-			} // choose
-		} else {										// sort file
-			choose ( argc ) {
-			  case 3:
-				&sortedfile = new( (const char *)argv[2] ); // open the output file
-				if ( fail( sortedfile ) ) {
-					serr | "Error! Could not open sorted output file \"" | argv[2] | "\"";
-					usage( argv );
-				} // if
-				fallthrough;
-			  case 2:
-				&unsortedfile = new( (const char *)argv[1] ); // open the input file
-				if ( fail( unsortedfile ) ) {
-					serr | "Error! Could not open unsorted input file \"" | argv[1] | "\"";
-					usage( argv );
-				} // if
-			} // choose
-		} // if
-	} // if
-	sortedfile | nlOff;									// turn off auto newline
-
-	enum { ValuesPerLine = 22 };						// number of values printed per line
-
-	if ( &unsortedfile ) {								// generate output ?
-		for () {
-			unsortedfile | size;						// read number of elements in the list
-		  if ( eof( unsortedfile ) ) break;
-			int * values = alloc( size );				// values to be sorted, too large to put on stack
-			for ( int counter = 0; counter < size; counter += 1 ) { // read unsorted numbers
-				unsortedfile | values[counter];
-				if ( counter != 0 && counter % ValuesPerLine == 0 ) sortedfile | nl | "  ";
-				sortedfile | values[counter];
-				if ( counter < size - 1 && (counter + 1) % ValuesPerLine != 0 ) sortedfile | ' ';
-			} // for
-			sortedfile | nl;
-			if ( size > 0 ) {							// values to sort ?
-				Quicksort QS = { values, size - 1, 0 }; // sort values
-			} // wait until sort tasks terminate
-			for ( int counter = 0; counter < size; counter += 1 ) { // print sorted list
-				if ( counter != 0 && counter % ValuesPerLine == 0 ) sortedfile | nl | "  ";
-				sortedfile | values[counter];
-				if ( counter < size - 1 && (counter + 1) % ValuesPerLine != 0 ) sortedfile | ' ';
-			} // for
-			sortedfile | nl | nl;
-
-			delete( values );
-		} // for
-		if ( &unsortedfile != &sin ) delete( &unsortedfile ); // close input/output files
-		if ( &sortedfile != &sout ) delete( &sortedfile );
-	} else {
-		processor processors[ (1 << depth) - 1 ] __attribute__(( unused )); // create 2^depth-1 kernel threads
-
-		int * values = alloc( size );				// values to be sorted, too large to put on stack
-		for ( int counter = 0; counter < size; counter += 1 ) { // generate unsorted numbers
-			values[counter] = size - counter;			// descending values
-		} // for
-		{
-			Quicksort QS = { values, size - 1, depth }; // sort values
-		} // wait until sort tasks terminate
-
-		// for ( int counter = 0; counter < size - 1; counter += 1 ) { // check sorting
-		// 	if ( values[counter] > values[counter + 1] ) abort();
-		// } // for
-
-		delete( values );
-	} // if
-} // main
-
-// Local Variables: //
-// tab-width: 4 //
-// compile-command: "cfa quickSort.c" //
-// End: //
Index: tests/concurrent/examples/quickSort.cfa
===================================================================
--- tests/concurrent/examples/quickSort.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
+++ tests/concurrent/examples/quickSort.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
@@ -0,0 +1,181 @@
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// quickSort.c -- In-place concurrent quick-sort: threads are created to partition to a specific depth, then sequential
+//		recursive-calls are use to sort each partition.
+//
+// Author           : Peter A. Buhr
+// Created On       : Wed Dec  6 12:15:52 2017
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Sat Dec 22 08:44:27 2018
+// Update Count     : 168
+//
+
+#include <fstream.hfa>
+#include <stdlib.hfa>
+#include <kernel.hfa>
+#include <thread.hfa>
+#include <string.h>										// strcmp
+
+thread Quicksort {
+	int * values;										// communication variables
+	int low, high, depth;
+};
+
+void ?{}( Quicksort & qs, int values[], int size, int depth ) {
+	qs.values = values;  qs.low = 0;  qs.high = size;  qs.depth = depth;
+} // Quicksort
+
+void main( Quicksort & qs ) {							// thread starts here
+	// nested routines: information hiding
+
+	void ?{}( Quicksort & qs, int values[], int low, int high, int depth ) {
+		qs.values = values;  qs.low = low;  qs.high = high;  qs.depth = depth;
+	} // Quicksort
+
+	void sort( int values[], int low, int high, int depth ) {
+		int left, right;								// index to left/right-hand side of the values
+		int pivot;										// pivot value of values
+		int swap;										// temporary
+
+		//verify();										// check for stack overflow due to recursion
+
+		// partition while 2 or more elements in the array
+		if ( low < high ) {
+			pivot = values[low + ( high - low ) / 2];
+			left  = low;
+			right = high;
+
+			// partition: move values less < pivot before the pivot and values > pivot after the pivot
+			do {
+				while ( values[left] < pivot ) left += 1; // changed values[left] < pivot
+				while ( pivot < values[right] ) right -= 1;
+				if ( left <= right ) {
+					swap = values[left];				// interchange values
+					values[left]  = values[right];
+					values[right] = swap;
+					left += 1;
+					right -= 1;
+				} // if
+			} while ( left <= right );
+
+			// restrict number of tasks to slightly greater than number of processors
+			if ( depth > 0 ) {
+				depth -= 1;
+				Quicksort rqs = { values, low, right, depth }; // concurrently sort upper half
+				//Quicksort lqs( values, left, high, depth ); // concurrently sort lower half
+				sort( values, left, high, depth );		// concurrently sort lower half
+			} else {
+				sort( values, low, right, 0 );			// sequentially sort lower half
+				sort( values, left, high, 0 );			// sequentially sort upper half
+			} // if
+		} // if
+	} // sort
+
+	with( qs ) {
+		sort( values, low, high, depth );
+	} // with
+} // main
+
+
+bool convert( int & val, const char * nptr ) {			// convert C string to integer
+	char * eptr;
+	int temp = strto( nptr, &eptr, 10 );				// do not change val on false
+	// true => entire string valid with no extra characters
+	return *nptr != '\0' && *eptr == '\0' ? val = temp, true : false;
+} // convert
+
+void usage( char * argv[] ) {
+	sout | "Usage:" | argv[0] | "( -s unsorted-file [ sorted-file ] | -t size (>= 0) [ depth (>= 0) ] )";
+	exit( EXIT_FAILURE );								// TERMINATE!
+} // usage
+
+
+int main( int argc, char * argv[] ) {
+	ifstream & unsortedfile = sin;
+	ofstream & sortedfile = sout;						// default value
+	int depth = 0, size;
+
+	if ( argc != 1 ) {									// do not use defaults
+		if ( argc < 2 || argc > 4 ) usage( argv );		// wrong number of options
+		if ( strcmp( argv[1], "-t" ) == 0 ) {			// timing ?
+			&unsortedfile = (ifstream *)0;				// no input
+			choose ( argc ) {
+			  case 4:
+				if ( ! convert( depth, argv[3] ) || depth < 0 ) usage( argv );
+				fallthrough;
+			  case 3:
+				if ( ! convert( size, argv[2] ) || size < 0 ) usage( argv );
+			} // choose
+		} else {										// sort file
+			choose ( argc ) {
+			  case 3:
+				&sortedfile = new( (const char *)argv[2] ); // open the output file
+				if ( fail( sortedfile ) ) {
+					serr | "Error! Could not open sorted output file \"" | argv[2] | "\"";
+					usage( argv );
+				} // if
+				fallthrough;
+			  case 2:
+				&unsortedfile = new( (const char *)argv[1] ); // open the input file
+				if ( fail( unsortedfile ) ) {
+					serr | "Error! Could not open unsorted input file \"" | argv[1] | "\"";
+					usage( argv );
+				} // if
+			} // choose
+		} // if
+	} // if
+	sortedfile | nlOff;									// turn off auto newline
+
+	enum { ValuesPerLine = 22 };						// number of values printed per line
+
+	if ( &unsortedfile ) {								// generate output ?
+		for () {
+			unsortedfile | size;						// read number of elements in the list
+		  if ( eof( unsortedfile ) ) break;
+			int * values = alloc( size );				// values to be sorted, too large to put on stack
+			for ( int counter = 0; counter < size; counter += 1 ) { // read unsorted numbers
+				unsortedfile | values[counter];
+				if ( counter != 0 && counter % ValuesPerLine == 0 ) sortedfile | nl | "  ";
+				sortedfile | values[counter];
+				if ( counter < size - 1 && (counter + 1) % ValuesPerLine != 0 ) sortedfile | ' ';
+			} // for
+			sortedfile | nl;
+			if ( size > 0 ) {							// values to sort ?
+				Quicksort QS = { values, size - 1, 0 }; // sort values
+			} // wait until sort tasks terminate
+			for ( int counter = 0; counter < size; counter += 1 ) { // print sorted list
+				if ( counter != 0 && counter % ValuesPerLine == 0 ) sortedfile | nl | "  ";
+				sortedfile | values[counter];
+				if ( counter < size - 1 && (counter + 1) % ValuesPerLine != 0 ) sortedfile | ' ';
+			} // for
+			sortedfile | nl | nl;
+
+			delete( values );
+		} // for
+		if ( &unsortedfile != &sin ) delete( &unsortedfile ); // close input/output files
+		if ( &sortedfile != &sout ) delete( &sortedfile );
+	} else {
+		processor processors[ (1 << depth) - 1 ] __attribute__(( unused )); // create 2^depth-1 kernel threads
+
+		int * values = alloc( size );				// values to be sorted, too large to put on stack
+		for ( int counter = 0; counter < size; counter += 1 ) { // generate unsorted numbers
+			values[counter] = size - counter;			// descending values
+		} // for
+		{
+			Quicksort QS = { values, size - 1, depth }; // sort values
+		} // wait until sort tasks terminate
+
+		// for ( int counter = 0; counter < size - 1; counter += 1 ) { // check sorting
+		// 	if ( values[counter] > values[counter + 1] ) abort();
+		// } // for
+
+		delete( values );
+	} // if
+} // main
+
+// Local Variables: //
+// tab-width: 4 //
+// compile-command: "cfa quickSort.c" //
+// End: //
Index: tests/concurrent/monitor.c
===================================================================
--- tests/concurrent/monitor.c	(revision d5b2ac82c5d162b3f54cf7db3bdcbb3a48149204)
+++ 	(revision )
@@ -1,43 +1,0 @@
-#include <fstream.hfa>
-#include <kernel.hfa>
-#include <monitor.hfa>
-#include <thread.hfa>
-
-monitor global_t {
-	int value;
-};
-
-void ?{}(global_t & this) {
-	this.value = 0;
-}
-
-static global_t global;
-
-void increment3( global_t & mutex this ) {
-	this.value += 1;
-}
-
-void increment2( global_t & mutex this ) {
-	increment3( this );
-}
-
-void increment( global_t & mutex this ) {
-	increment2( this );
-}
-
-thread MyThread {};
-
-void main( MyThread & this ) {
-	for(int i = 0; i < 1_000_000; i++) {
-		increment( global );
-	}
-}
-
-int main(int argc, char* argv[]) {
-	assert( global.__mon.entry_queue.tail != NULL );
-	processor p;
-	{
-		MyThread f[4];
-	}
-	sout | global.value;
-}
Index: tests/concurrent/monitor.cfa
===================================================================
--- tests/concurrent/monitor.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
+++ tests/concurrent/monitor.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
@@ -0,0 +1,43 @@
+#include <fstream.hfa>
+#include <kernel.hfa>
+#include <monitor.hfa>
+#include <thread.hfa>
+
+monitor global_t {
+	int value;
+};
+
+void ?{}(global_t & this) {
+	this.value = 0;
+}
+
+static global_t global;
+
+void increment3( global_t & mutex this ) {
+	this.value += 1;
+}
+
+void increment2( global_t & mutex this ) {
+	increment3( this );
+}
+
+void increment( global_t & mutex this ) {
+	increment2( this );
+}
+
+thread MyThread {};
+
+void main( MyThread & this ) {
+	for(int i = 0; i < 1_000_000; i++) {
+		increment( global );
+	}
+}
+
+int main(int argc, char* argv[]) {
+	assert( global.__mon.entry_queue.tail != NULL );
+	processor p;
+	{
+		MyThread f[4];
+	}
+	sout | global.value;
+}
Index: tests/concurrent/multi-monitor.c
===================================================================
--- tests/concurrent/multi-monitor.c	(revision d5b2ac82c5d162b3f54cf7db3bdcbb3a48149204)
+++ 	(revision )
@@ -1,55 +1,0 @@
-#include <fstream.hfa>
-#include <kernel.hfa>
-#include <monitor.hfa>
-#include <thread.hfa>
-
-static int global12, global23, global13;
-
-monitor monitor_t {};
-
-static monitor_t m1, m2, m3;
-
-void increment( monitor_t & mutex p1, monitor_t & mutex p2, int & value ) {
-	value += 1;
-}
-
-thread MyThread {
-	int target;
-};
-
-void ?{}( MyThread & this, int target ) {
-	this.target = target;
-}
-
-void ^?{}( MyThread & mutex this ) {}
-
-void main( MyThread & this ) {
-	for(int i = 0; i < 1000000; i++) {
-		choose(this.target) {
-			case 0: increment( m1, m2, global12 );
-			case 1: increment( m2, m3, global23 );
-			case 2: increment( m1, m3, global13 );
-		}
-	}
-}
-
-forall(dtype T | sized(T) | { void ^?{}(T & mutex); })
-void delete_mutex(T * x) {
-	^(*x){};
-	free(x);
-}
-
-int main(int argc, char* argv[]) {
-	processor p;
-	{
-		MyThread * f[6];
-		for(int i = 0; i < 6; i++) {
-			f[i] = new(i % 3);
-		}
-
-		for(int i = 0; i < 6; i++) {
-			delete_mutex( f[i] );
-		}
-	}
-	sout | global12 | global23 | global13;
-}
Index: tests/concurrent/multi-monitor.cfa
===================================================================
--- tests/concurrent/multi-monitor.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
+++ tests/concurrent/multi-monitor.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
@@ -0,0 +1,55 @@
+#include <fstream.hfa>
+#include <kernel.hfa>
+#include <monitor.hfa>
+#include <thread.hfa>
+
+static int global12, global23, global13;
+
+monitor monitor_t {};
+
+static monitor_t m1, m2, m3;
+
+void increment( monitor_t & mutex p1, monitor_t & mutex p2, int & value ) {
+	value += 1;
+}
+
+thread MyThread {
+	int target;
+};
+
+void ?{}( MyThread & this, int target ) {
+	this.target = target;
+}
+
+void ^?{}( MyThread & mutex this ) {}
+
+void main( MyThread & this ) {
+	for(int i = 0; i < 1000000; i++) {
+		choose(this.target) {
+			case 0: increment( m1, m2, global12 );
+			case 1: increment( m2, m3, global23 );
+			case 2: increment( m1, m3, global13 );
+		}
+	}
+}
+
+forall(dtype T | sized(T) | { void ^?{}(T & mutex); })
+void delete_mutex(T * x) {
+	^(*x){};
+	free(x);
+}
+
+int main(int argc, char* argv[]) {
+	processor p;
+	{
+		MyThread * f[6];
+		for(int i = 0; i < 6; i++) {
+			f[i] = new(i % 3);
+		}
+
+		for(int i = 0; i < 6; i++) {
+			delete_mutex( f[i] );
+		}
+	}
+	sout | global12 | global23 | global13;
+}
Index: tests/concurrent/preempt.c
===================================================================
--- tests/concurrent/preempt.c	(revision d5b2ac82c5d162b3f54cf7db3bdcbb3a48149204)
+++ 	(revision )
@@ -1,59 +1,0 @@
-#include <kernel.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 volatile int counter = 0;
-
-thread worker_t {
-	int value;
-};
-
-void ?{}( worker_t & this, int value ) {
-	this.value = value;
-}
-
-void main(worker_t & this) {
-	while(TEST(counter < N)) {
-		__cfaabi_check_preemption();
-		if( (counter % 7) == this.value ) {
-			__cfaabi_check_preemption();
-			int next = __atomic_add_fetch_4(&counter, 1, __ATOMIC_SEQ_CST);
-			__cfaabi_check_preemption();
-			if( (next % 100) == 0 ) printf("%d\n", (int)next);
-			__cfaabi_check_preemption();
-		}
-		__cfaabi_check_preemption();
-		KICK_WATCHDOG;
-	}
-}
-
-int main(int argc, char* argv[]) {
-	processor p;
-	{
-		worker_t w0 = 0;
-		worker_t w1 = 1;
-		worker_t w2 = 2;
-		worker_t w3 = 3;
-		worker_t w4 = 4;
-		worker_t w5 = 5;
-		worker_t w6 = 6;
-	}
-}
Index: tests/concurrent/preempt.cfa
===================================================================
--- tests/concurrent/preempt.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
+++ tests/concurrent/preempt.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
@@ -0,0 +1,59 @@
+#include <kernel.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 volatile int counter = 0;
+
+thread worker_t {
+	int value;
+};
+
+void ?{}( worker_t & this, int value ) {
+	this.value = value;
+}
+
+void main(worker_t & this) {
+	while(TEST(counter < N)) {
+		__cfaabi_check_preemption();
+		if( (counter % 7) == this.value ) {
+			__cfaabi_check_preemption();
+			int next = __atomic_add_fetch_4(&counter, 1, __ATOMIC_SEQ_CST);
+			__cfaabi_check_preemption();
+			if( (next % 100) == 0 ) printf("%d\n", (int)next);
+			__cfaabi_check_preemption();
+		}
+		__cfaabi_check_preemption();
+		KICK_WATCHDOG;
+	}
+}
+
+int main(int argc, char* argv[]) {
+	processor p;
+	{
+		worker_t w0 = 0;
+		worker_t w1 = 1;
+		worker_t w2 = 2;
+		worker_t w3 = 3;
+		worker_t w4 = 4;
+		worker_t w5 = 5;
+		worker_t w6 = 6;
+	}
+}
Index: tests/concurrent/signal/block.c
===================================================================
--- tests/concurrent/signal/block.c	(revision d5b2ac82c5d162b3f54cf7db3bdcbb3a48149204)
+++ 	(revision )
@@ -1,139 +1,0 @@
-//---------------------------------------------------------
-// Barging test
-// Ensures that no barging can occur between :
-//   - the frontend of the signal_block and the signaled thread
-//   - the signaled  threadand the backend of the signal_block
-//---------------------------------------------------------
-
-
-#include <fstream.hfa>
-#include <kernel.hfa>
-#include <monitor.hfa>
-#include <stdlib.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 = 150_000ul;
-#else
-static const unsigned long N = 5_000ul;
-#endif
-
-enum state_t { WAITED, SIGNAL, BARGE };
-
-monitor global_data_t {
-	thread_desc * last_thread;
-	thread_desc * last_signaller;
-};
-
-void ?{} ( global_data_t & this ) {
-	this.last_thread = NULL;
-	this.last_signaller = NULL;
-}
-
-void ^?{} ( global_data_t & mutex this ) {}
-
-global_data_t globalA, globalB;
-
-condition cond;
-
-volatile bool done;
-
-//------------------------------------------------------------------------------
-void wait_op( global_data_t & mutex a, global_data_t & mutex b, unsigned i ) {
-    wait( cond, (uintptr_t)active_thread() );
-
-	yield( random( 10 ) );
-
-	if(a.last_thread != a.last_signaller || b.last_thread != b.last_signaller ) {
-		sout | "ERROR Barging detected, expected" | a.last_signaller | b.last_signaller | "got" | a.last_thread | b.last_thread;
-		abort();
-	}
-
-	a.last_thread = b.last_thread = active_thread();
-
-	yield( random( 10 ) );
-}
-
-thread Waiter {};
-void main( Waiter & this ) {
-	for( int i = 0; TEST(i < N); i++ ) {
-		wait_op( globalA, globalB, i );
-		KICK_WATCHDOG;
-	}
-}
-
-//------------------------------------------------------------------------------
-void signal_op( global_data_t & mutex a, global_data_t & mutex b ) {
-	yield( random( 10 ) );
-
-	[a.last_thread, b.last_thread, a.last_signaller, b.last_signaller] = active_thread();
-
-	if( !is_empty( cond ) ) {
-
-		thread_desc * next = front( cond );
-
-		if( ! signal_block( cond ) ) {
-			sout | "ERROR expected to be able to signal";
-			abort();
-		}
-
-		yield( random( 10 ) );
-
-		if(a.last_thread != next || b.last_thread != next) {
-			sout | "ERROR Barging detected, expected" | next | "got" | a.last_thread | b.last_thread;
-			abort();
-		}
-	}
-
-}
-
-thread Signaller {};
-void main( Signaller & this ) {
-	while( !done ) {
-		signal_op( globalA, globalB );
-	}
-}
-
-//------------------------------------------------------------------------------
-void barge_op( global_data_t & mutex a ) {
-	a.last_thread = active_thread();
-}
-
-thread Barger {};
-void main( Barger & this ) {
-	for( unsigned i = 0; !done; i++ ) {
-		//Choose some monitor to barge into with some irregular pattern
-		bool choose_a = (i % 13) > (i % 17);
-		if ( choose_a ) barge_op( globalA );
-		else barge_op( globalB );
-	}
-}
-
-//------------------------------------------------------------------------------
-
-int main(int argc, char* argv[]) {
-	srandom( time( NULL ) );
-	done = false;
-	processor p;
-	{
-		Signaller s[4];
-		Barger b[13];
-		sout | "Starting waiters";
-		{
-			Waiter w[3];
-		}
-		sout | "Waiters done";
-		done = true;
-	}
-}
Index: tests/concurrent/signal/block.cfa
===================================================================
--- tests/concurrent/signal/block.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
+++ tests/concurrent/signal/block.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
@@ -0,0 +1,139 @@
+//---------------------------------------------------------
+// Barging test
+// Ensures that no barging can occur between :
+//   - the frontend of the signal_block and the signaled thread
+//   - the signaled  threadand the backend of the signal_block
+//---------------------------------------------------------
+
+
+#include <fstream.hfa>
+#include <kernel.hfa>
+#include <monitor.hfa>
+#include <stdlib.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 = 150_000ul;
+#else
+static const unsigned long N = 5_000ul;
+#endif
+
+enum state_t { WAITED, SIGNAL, BARGE };
+
+monitor global_data_t {
+	thread_desc * last_thread;
+	thread_desc * last_signaller;
+};
+
+void ?{} ( global_data_t & this ) {
+	this.last_thread = NULL;
+	this.last_signaller = NULL;
+}
+
+void ^?{} ( global_data_t & mutex this ) {}
+
+global_data_t globalA, globalB;
+
+condition cond;
+
+volatile bool done;
+
+//------------------------------------------------------------------------------
+void wait_op( global_data_t & mutex a, global_data_t & mutex b, unsigned i ) {
+    wait( cond, (uintptr_t)active_thread() );
+
+	yield( random( 10 ) );
+
+	if(a.last_thread != a.last_signaller || b.last_thread != b.last_signaller ) {
+		sout | "ERROR Barging detected, expected" | a.last_signaller | b.last_signaller | "got" | a.last_thread | b.last_thread;
+		abort();
+	}
+
+	a.last_thread = b.last_thread = active_thread();
+
+	yield( random( 10 ) );
+}
+
+thread Waiter {};
+void main( Waiter & this ) {
+	for( int i = 0; TEST(i < N); i++ ) {
+		wait_op( globalA, globalB, i );
+		KICK_WATCHDOG;
+	}
+}
+
+//------------------------------------------------------------------------------
+void signal_op( global_data_t & mutex a, global_data_t & mutex b ) {
+	yield( random( 10 ) );
+
+	[a.last_thread, b.last_thread, a.last_signaller, b.last_signaller] = active_thread();
+
+	if( !is_empty( cond ) ) {
+
+		thread_desc * next = front( cond );
+
+		if( ! signal_block( cond ) ) {
+			sout | "ERROR expected to be able to signal";
+			abort();
+		}
+
+		yield( random( 10 ) );
+
+		if(a.last_thread != next || b.last_thread != next) {
+			sout | "ERROR Barging detected, expected" | next | "got" | a.last_thread | b.last_thread;
+			abort();
+		}
+	}
+
+}
+
+thread Signaller {};
+void main( Signaller & this ) {
+	while( !done ) {
+		signal_op( globalA, globalB );
+	}
+}
+
+//------------------------------------------------------------------------------
+void barge_op( global_data_t & mutex a ) {
+	a.last_thread = active_thread();
+}
+
+thread Barger {};
+void main( Barger & this ) {
+	for( unsigned i = 0; !done; i++ ) {
+		//Choose some monitor to barge into with some irregular pattern
+		bool choose_a = (i % 13) > (i % 17);
+		if ( choose_a ) barge_op( globalA );
+		else barge_op( globalB );
+	}
+}
+
+//------------------------------------------------------------------------------
+
+int main(int argc, char* argv[]) {
+	srandom( time( NULL ) );
+	done = false;
+	processor p;
+	{
+		Signaller s[4];
+		Barger b[13];
+		sout | "Starting waiters";
+		{
+			Waiter w[3];
+		}
+		sout | "Waiters done";
+		done = true;
+	}
+}
Index: tests/concurrent/signal/disjoint.c
===================================================================
--- tests/concurrent/signal/disjoint.c	(revision d5b2ac82c5d162b3f54cf7db3bdcbb3a48149204)
+++ 	(revision )
@@ -1,129 +1,0 @@
-#include <fstream.hfa>
-#include <kernel.hfa>
-#include <monitor.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 = 300_000ul;
-#else
-static const unsigned long N = 10_000ul;
-#endif
-
-enum state_t { WAIT, SIGNAL, BARGE };
-
-monitor global_t {};
-global_t mut;
-
-monitor global_data_t;
-void ?{}( global_data_t & this );
-void ^?{} ( global_data_t & mutex this );
-
-monitor global_data_t {
-	int counter;
-	state_t state;
-} data;
-
-condition cond;
-
-volatile bool all_done;
-
-void ?{}( global_data_t & this ) {
-	this.counter == 0;
-	this.state = BARGE;
-}
-
-void ^?{} ( global_data_t & mutex this ) {}
-
-//------------------------------------------------------------------------------
-// Barging logic
-void barge( global_data_t & mutex d ) {
-	d.state = BARGE;
-}
-
-thread Barger {};
-
-void main( Barger & this ) {
-	while( !all_done ) {
-		barge( data );
-		yield();
-	}
-}
-
-//------------------------------------------------------------------------------
-// Waiting logic
-bool wait( global_t & mutex m, global_data_t & mutex d ) {
-	wait( cond );
-	if( d.state != SIGNAL ) {
-		sout | "ERROR barging!";
-	}
-
-	#if !defined(TEST_FOREVER)
-		d.counter++;
-		if( (d.counter % 1000) == 0 ) sout | d.counter;
-	#endif
-
-	return TEST(d.counter < N);
-}
-
-thread Waiter {};
-
-void main( Waiter & this ) {
-	while( wait( mut, data ) ) { KICK_WATCHDOG; yield(); }
-}
-
-
-//------------------------------------------------------------------------------
-// Signalling logic
-void signal( condition & cond, global_t & mutex a, global_data_t & mutex b ) {
-	b.state = SIGNAL;
-	signal( cond );
-}
-
-void logic( global_t & mutex a ) {
-	signal( cond, a, data );
-
-	yield( random( 10 ) );
-
-	//This is technically a mutual exclusion violation but the mutex monitor protects us
-	bool running = TEST(data.counter < N) && data.counter > 0;
-	if( data.state != SIGNAL && running ) {
-		sout | "ERROR Eager signal" | data.state;
-	}
-}
-
-thread Signaller {};
-
-void main( Signaller & this ) {
-	while( !all_done ) {
-		logic( mut );
-		yield();
-	}
-}
-
-//------------------------------------------------------------------------------
-// Main loop
-int main(int argc, char* argv[]) {
-	srandom( time( NULL ) );
-	all_done = false;
-	processor p;
-	{
-		Signaller s;
-		Barger b[17];
-		{
-			Waiter w[4];
-		}
-		sout | "All waiter done";
-		all_done = true;
-	}
-}
Index: tests/concurrent/signal/disjoint.cfa
===================================================================
--- tests/concurrent/signal/disjoint.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
+++ tests/concurrent/signal/disjoint.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
@@ -0,0 +1,129 @@
+#include <fstream.hfa>
+#include <kernel.hfa>
+#include <monitor.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 = 300_000ul;
+#else
+static const unsigned long N = 10_000ul;
+#endif
+
+enum state_t { WAIT, SIGNAL, BARGE };
+
+monitor global_t {};
+global_t mut;
+
+monitor global_data_t;
+void ?{}( global_data_t & this );
+void ^?{} ( global_data_t & mutex this );
+
+monitor global_data_t {
+	int counter;
+	state_t state;
+} data;
+
+condition cond;
+
+volatile bool all_done;
+
+void ?{}( global_data_t & this ) {
+	this.counter == 0;
+	this.state = BARGE;
+}
+
+void ^?{} ( global_data_t & mutex this ) {}
+
+//------------------------------------------------------------------------------
+// Barging logic
+void barge( global_data_t & mutex d ) {
+	d.state = BARGE;
+}
+
+thread Barger {};
+
+void main( Barger & this ) {
+	while( !all_done ) {
+		barge( data );
+		yield();
+	}
+}
+
+//------------------------------------------------------------------------------
+// Waiting logic
+bool wait( global_t & mutex m, global_data_t & mutex d ) {
+	wait( cond );
+	if( d.state != SIGNAL ) {
+		sout | "ERROR barging!";
+	}
+
+	#if !defined(TEST_FOREVER)
+		d.counter++;
+		if( (d.counter % 1000) == 0 ) sout | d.counter;
+	#endif
+
+	return TEST(d.counter < N);
+}
+
+thread Waiter {};
+
+void main( Waiter & this ) {
+	while( wait( mut, data ) ) { KICK_WATCHDOG; yield(); }
+}
+
+
+//------------------------------------------------------------------------------
+// Signalling logic
+void signal( condition & cond, global_t & mutex a, global_data_t & mutex b ) {
+	b.state = SIGNAL;
+	signal( cond );
+}
+
+void logic( global_t & mutex a ) {
+	signal( cond, a, data );
+
+	yield( random( 10 ) );
+
+	//This is technically a mutual exclusion violation but the mutex monitor protects us
+	bool running = TEST(data.counter < N) && data.counter > 0;
+	if( data.state != SIGNAL && running ) {
+		sout | "ERROR Eager signal" | data.state;
+	}
+}
+
+thread Signaller {};
+
+void main( Signaller & this ) {
+	while( !all_done ) {
+		logic( mut );
+		yield();
+	}
+}
+
+//------------------------------------------------------------------------------
+// Main loop
+int main(int argc, char* argv[]) {
+	srandom( time( NULL ) );
+	all_done = false;
+	processor p;
+	{
+		Signaller s;
+		Barger b[17];
+		{
+			Waiter w[4];
+		}
+		sout | "All waiter done";
+		all_done = true;
+	}
+}
Index: tests/concurrent/signal/wait.c
===================================================================
--- tests/concurrent/signal/wait.c	(revision d5b2ac82c5d162b3f54cf7db3bdcbb3a48149204)
+++ 	(revision )
@@ -1,153 +1,0 @@
-//---------------------------------------------------------
-// Multi wait test
-// Ensures that no deadlock from waiting/signalling conditions
-//---------------------------------------------------------
-
-
-#include <fstream.hfa>
-#include <kernel.hfa>
-#include <monitor.hfa>
-#include <stdlib.hfa>
-#include <thread.hfa>
-#include <time.hfa>
-
-#define __kick_rate 12000ul
-#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 = 375_000ul;
-#else
-static const unsigned long N = 2_500ul;
-#endif
-
-monitor global_t {};
-
-global_t globalA;
-global_t globalB;
-global_t globalC;
-
-condition condAB, condAC, condBC, condABC;
-
-thread Signaler {};
-thread WaiterAB {};
-thread WaiterAC {};
-thread WaiterBC {};
-thread WaiterABC{};
-
-volatile int waiter_left;
-
-//----------------------------------------------------------------------------------------------------
-// Tools
-void signal( condition & cond, global_t & mutex a, global_t & mutex b ) {
-	signal( cond );
-}
-
-void signal( condition & cond, global_t & mutex a, global_t & mutex b, global_t & mutex c ) {
-	signal( cond );
-}
-
-void wait( condition & cond, global_t & mutex a, global_t & mutex b ) {
-	wait( cond );
-}
-
-void wait( condition & cond, global_t & mutex a, global_t & mutex b, global_t & mutex c ) {
-	wait( cond );
-}
-
-//----------------------------------------------------------------------------------------------------
-// Signaler
-void main( Signaler & this ) {
-
-	while( waiter_left != 0 ) {
-		unsigned action = random( 4 );
-		switch( action ) {
-			case 0:
-				signal( condABC, globalA, globalB, globalC );
-				break;
-			case 1:
-				signal( condAB , globalA, globalB );
-				break;
-			case 2:
-				signal( condBC , globalB, globalC );
-				break;
-			case 3:
-				signal( condAC , globalA, globalC );
-				break;
-			default:
-				sout | "Something went wrong";
-				abort();
-		}
-		yield();
-	}
-}
-
-//----------------------------------------------------------------------------------------------------
-// Waiter ABC
-void main( WaiterABC & this ) {
-	for( int i = 0; TEST(i < N); i++ ) {
-		wait( condABC, globalA, globalB, globalC );
-		KICK_WATCHDOG;
-	}
-
-	__sync_fetch_and_sub_4( &waiter_left, 1);
-}
-
-//----------------------------------------------------------------------------------------------------
-// Waiter AB
-void main( WaiterAB & this ) {
-	for( int i = 0; TEST(i < N); i++ ) {
-		wait( condAB , globalA, globalB );
-		KICK_WATCHDOG;
-	}
-
-	__sync_fetch_and_sub_4( &waiter_left, 1);
-}
-
-//----------------------------------------------------------------------------------------------------
-// Waiter AC
-void main( WaiterAC & this ) {
-	for( int i = 0; TEST(i < N); i++ ) {
-		wait( condAC , globalA, globalC );
-		KICK_WATCHDOG;
-	}
-
-	__sync_fetch_and_sub_4( &waiter_left, 1);
-}
-
-//----------------------------------------------------------------------------------------------------
-// Waiter BC
-void main( WaiterBC & this ) {
-	for( int i = 0; TEST(i < N); i++ ) {
-		wait( condBC , globalB, globalC );
-		KICK_WATCHDOG;
-	}
-
-	__sync_fetch_and_sub_4( &waiter_left, 1);
-}
-
-//----------------------------------------------------------------------------------------------------
-// Main
-int main(int argc, char* argv[]) {
-	srandom( time( NULL ) );
-	waiter_left = 4;
-	processor p[2];
-	sout | "Starting";
-	{
-		Signaler  e;
-		{
-			WaiterABC a;
-			WaiterAB  b;
-			WaiterBC  c;
-			WaiterAC  d;
-		}
-	}
-	sout | "Done";
-}
Index: tests/concurrent/signal/wait.cfa
===================================================================
--- tests/concurrent/signal/wait.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
+++ tests/concurrent/signal/wait.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
@@ -0,0 +1,153 @@
+//---------------------------------------------------------
+// Multi wait test
+// Ensures that no deadlock from waiting/signalling conditions
+//---------------------------------------------------------
+
+
+#include <fstream.hfa>
+#include <kernel.hfa>
+#include <monitor.hfa>
+#include <stdlib.hfa>
+#include <thread.hfa>
+#include <time.hfa>
+
+#define __kick_rate 12000ul
+#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 = 375_000ul;
+#else
+static const unsigned long N = 2_500ul;
+#endif
+
+monitor global_t {};
+
+global_t globalA;
+global_t globalB;
+global_t globalC;
+
+condition condAB, condAC, condBC, condABC;
+
+thread Signaler {};
+thread WaiterAB {};
+thread WaiterAC {};
+thread WaiterBC {};
+thread WaiterABC{};
+
+volatile int waiter_left;
+
+//----------------------------------------------------------------------------------------------------
+// Tools
+void signal( condition & cond, global_t & mutex a, global_t & mutex b ) {
+	signal( cond );
+}
+
+void signal( condition & cond, global_t & mutex a, global_t & mutex b, global_t & mutex c ) {
+	signal( cond );
+}
+
+void wait( condition & cond, global_t & mutex a, global_t & mutex b ) {
+	wait( cond );
+}
+
+void wait( condition & cond, global_t & mutex a, global_t & mutex b, global_t & mutex c ) {
+	wait( cond );
+}
+
+//----------------------------------------------------------------------------------------------------
+// Signaler
+void main( Signaler & this ) {
+
+	while( waiter_left != 0 ) {
+		unsigned action = random( 4 );
+		switch( action ) {
+			case 0:
+				signal( condABC, globalA, globalB, globalC );
+				break;
+			case 1:
+				signal( condAB , globalA, globalB );
+				break;
+			case 2:
+				signal( condBC , globalB, globalC );
+				break;
+			case 3:
+				signal( condAC , globalA, globalC );
+				break;
+			default:
+				sout | "Something went wrong";
+				abort();
+		}
+		yield();
+	}
+}
+
+//----------------------------------------------------------------------------------------------------
+// Waiter ABC
+void main( WaiterABC & this ) {
+	for( int i = 0; TEST(i < N); i++ ) {
+		wait( condABC, globalA, globalB, globalC );
+		KICK_WATCHDOG;
+	}
+
+	__sync_fetch_and_sub_4( &waiter_left, 1);
+}
+
+//----------------------------------------------------------------------------------------------------
+// Waiter AB
+void main( WaiterAB & this ) {
+	for( int i = 0; TEST(i < N); i++ ) {
+		wait( condAB , globalA, globalB );
+		KICK_WATCHDOG;
+	}
+
+	__sync_fetch_and_sub_4( &waiter_left, 1);
+}
+
+//----------------------------------------------------------------------------------------------------
+// Waiter AC
+void main( WaiterAC & this ) {
+	for( int i = 0; TEST(i < N); i++ ) {
+		wait( condAC , globalA, globalC );
+		KICK_WATCHDOG;
+	}
+
+	__sync_fetch_and_sub_4( &waiter_left, 1);
+}
+
+//----------------------------------------------------------------------------------------------------
+// Waiter BC
+void main( WaiterBC & this ) {
+	for( int i = 0; TEST(i < N); i++ ) {
+		wait( condBC , globalB, globalC );
+		KICK_WATCHDOG;
+	}
+
+	__sync_fetch_and_sub_4( &waiter_left, 1);
+}
+
+//----------------------------------------------------------------------------------------------------
+// Main
+int main(int argc, char* argv[]) {
+	srandom( time( NULL ) );
+	waiter_left = 4;
+	processor p[2];
+	sout | "Starting";
+	{
+		Signaler  e;
+		{
+			WaiterABC a;
+			WaiterAB  b;
+			WaiterBC  c;
+			WaiterAC  d;
+		}
+	}
+	sout | "Done";
+}
Index: tests/concurrent/thread.c
===================================================================
--- tests/concurrent/thread.c	(revision d5b2ac82c5d162b3f54cf7db3bdcbb3a48149204)
+++ 	(revision )
@@ -1,40 +1,0 @@
-#include <fstream.hfa>
-#include <kernel.hfa>
-#include <stdlib.hfa>
-#include <thread.hfa>
-
-thread First  { semaphore* lock; };
-thread Second { semaphore* lock; };
-
-void ?{}( First  & this, semaphore & lock ) { ((thread&)this){"Thread 1"}; this.lock = &lock; }
-void ?{}( Second & this, semaphore & lock ) { ((thread&)this){"Thread 2"}; this.lock = &lock; }
-
-void main(First& this) {
-	for(int i = 0; i < 10; i++) {
-		sout | "First : Suspend No." | i + 1;
-		yield();
-	}
-	V(*this.lock);
-}
-
-void main(Second& this) {
-	P(*this.lock);
-	for(int i = 0; i < 10; i++) {
-		sout | "Second : Suspend No." | i + 1;
-		yield();
-	}
-}
-
-
-int main(int argc, char* argv[]) {
-	semaphore lock = { 0 };
-	sout | "User main begin";
-	{
-		processor p;
-		{
-			First  f = { lock };
-			Second s = { lock };
-		}
-	}
-	sout | "User main end";
-}
Index: tests/concurrent/thread.cfa
===================================================================
--- tests/concurrent/thread.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
+++ tests/concurrent/thread.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
@@ -0,0 +1,40 @@
+#include <fstream.hfa>
+#include <kernel.hfa>
+#include <stdlib.hfa>
+#include <thread.hfa>
+
+thread First  { semaphore* lock; };
+thread Second { semaphore* lock; };
+
+void ?{}( First  & this, semaphore & lock ) { ((thread&)this){"Thread 1"}; this.lock = &lock; }
+void ?{}( Second & this, semaphore & lock ) { ((thread&)this){"Thread 2"}; this.lock = &lock; }
+
+void main(First& this) {
+	for(int i = 0; i < 10; i++) {
+		sout | "First : Suspend No." | i + 1;
+		yield();
+	}
+	V(*this.lock);
+}
+
+void main(Second& this) {
+	P(*this.lock);
+	for(int i = 0; i < 10; i++) {
+		sout | "Second : Suspend No." | i + 1;
+		yield();
+	}
+}
+
+
+int main(int argc, char* argv[]) {
+	semaphore lock = { 0 };
+	sout | "User main begin";
+	{
+		processor p;
+		{
+			First  f = { lock };
+			Second s = { lock };
+		}
+	}
+	sout | "User main end";
+}
Index: tests/concurrent/waitfor/barge.c
===================================================================
--- tests/concurrent/waitfor/barge.c	(revision d5b2ac82c5d162b3f54cf7db3bdcbb3a48149204)
+++ 	(revision )
@@ -1,92 +1,0 @@
-//---------------------------------------------------------
-// Barging test
-// Ensures that no barging can occur between :
-//   - the frontend of the waitfor and the waited call
-//   - the waited call and the backend of the waitfor
-//---------------------------------------------------------
-
-#include <fstream.hfa>
-#include <kernel.hfa>
-#include <monitor.hfa>
-#include <stdlib.hfa>
-#include <thread.hfa>
-
-#include <stdbool.h>
-
-static const unsigned long N = 5_000ul;
-
-enum state_t { WAITFOR, CALL, BARGE };
-
-monitor global_t {
-	bool done;
-	bool started;
-	state_t state;
-};
-
-void ?{} ( global_t & this ) {
-	this.done = false;
-	this.started = false;
-	this.state = BARGE;
-}
-
-void ^?{} ( global_t & mutex this ) {}
-
-global_t global;
-
-bool barge( global_t & mutex this ) {
-	this.state = BARGE;
-	return !this.done;
-}
-
-thread barger_t {};
-void main( barger_t & this ) {
-	yield();
-	while( barge( global ) ) { yield(random( 10 )); }
-}
-
-bool do_call( global_t & mutex this ) {
-	yield(random( 10 ));
-	if( this.state != WAITFOR && !this.done && this.started ) {
-		serr | "Barging before caller detected";
-	}
-
-	this.state = CALL;
-	return !this.done;
-}
-
-thread caller_t {};
-void main( caller_t & this ) {
-	while( do_call(global) ) { yield(random( 10 )); }
-}
-
-void do_wait( global_t & mutex this ) {
-	this.started = true;
-	for( int i = 0; i < N; i++) {
-		yield(random( 10 ));
-		this.state = WAITFOR;
-		waitfor(do_call, this) {
-			sout | i;
-		}
-
-		if( this.state != CALL ) {
-			serr | "Barging after caller detected";
-		}
-	}
-
-	this.done = true;
-}
-
-thread waiter_t{};
-void main( waiter_t & this ) {
-	do_wait(global);
-}
-
-int main() {
-	sout | "Starting";
-	{
-		barger_t bargers[17];
-		caller_t callers[7];
-		waiter_t waiters;
-	}
-	sout | "Stopping";
-}
Index: tests/concurrent/waitfor/barge.cfa
===================================================================
--- tests/concurrent/waitfor/barge.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
+++ tests/concurrent/waitfor/barge.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
@@ -0,0 +1,92 @@
+//---------------------------------------------------------
+// Barging test
+// Ensures that no barging can occur between :
+//   - the frontend of the waitfor and the waited call
+//   - the waited call and the backend of the waitfor
+//---------------------------------------------------------
+
+#include <fstream.hfa>
+#include <kernel.hfa>
+#include <monitor.hfa>
+#include <stdlib.hfa>
+#include <thread.hfa>
+
+#include <stdbool.h>
+
+static const unsigned long N = 5_000ul;
+
+enum state_t { WAITFOR, CALL, BARGE };
+
+monitor global_t {
+	bool done;
+	bool started;
+	state_t state;
+};
+
+void ?{} ( global_t & this ) {
+	this.done = false;
+	this.started = false;
+	this.state = BARGE;
+}
+
+void ^?{} ( global_t & mutex this ) {}
+
+global_t global;
+
+bool barge( global_t & mutex this ) {
+	this.state = BARGE;
+	return !this.done;
+}
+
+thread barger_t {};
+void main( barger_t & this ) {
+	yield();
+	while( barge( global ) ) { yield(random( 10 )); }
+}
+
+bool do_call( global_t & mutex this ) {
+	yield(random( 10 ));
+	if( this.state != WAITFOR && !this.done && this.started ) {
+		serr | "Barging before caller detected";
+	}
+
+	this.state = CALL;
+	return !this.done;
+}
+
+thread caller_t {};
+void main( caller_t & this ) {
+	while( do_call(global) ) { yield(random( 10 )); }
+}
+
+void do_wait( global_t & mutex this ) {
+	this.started = true;
+	for( int i = 0; i < N; i++) {
+		yield(random( 10 ));
+		this.state = WAITFOR;
+		waitfor(do_call, this) {
+			sout | i;
+		}
+
+		if( this.state != CALL ) {
+			serr | "Barging after caller detected";
+		}
+	}
+
+	this.done = true;
+}
+
+thread waiter_t{};
+void main( waiter_t & this ) {
+	do_wait(global);
+}
+
+int main() {
+	sout | "Starting";
+	{
+		barger_t bargers[17];
+		caller_t callers[7];
+		waiter_t waiters;
+	}
+	sout | "Stopping";
+}
Index: tests/concurrent/waitfor/dtor.c
===================================================================
--- tests/concurrent/waitfor/dtor.c	(revision d5b2ac82c5d162b3f54cf7db3bdcbb3a48149204)
+++ 	(revision )
@@ -1,63 +1,0 @@
-//---------------------------------------------------------
-// Barging test
-// Ensures the statement order is reverse when using waitfor ^?{}
-//---------------------------------------------------------
-
-#include <fstream.hfa>
-#include <kernel.hfa>
-#include <monitor.hfa>
-#include <stdlib.hfa>
-#include <thread.hfa>
-
-#include <stdbool.h>
-
-static const unsigned long N = 5_000ul;
-
-enum state_t {
-	CTOR,
-	MAIN,
-	AFTER,
-	END,
-	DTOR
-};
-
-thread dummy_t {
-	state_t state;
-};
-
-static inline void set_state( dummy_t & this, state_t state) {
-	switch(state) {
-		case CTOR  : break;
-		case MAIN  : if( this.state != CTOR  ) { serr | "ERROR Expected state to be CTOR" ; abort(); } this.state = state; break;
-		case AFTER : if( this.state != MAIN  ) { serr | "ERROR Expected state to be MAIN" ; abort(); } this.state = state; break;
-		case END   : if( this.state != AFTER ) { serr | "ERROR Expected state to be AFTER"; abort(); } this.state = state; break;
-		case DTOR  : if( this.state != END   ) { serr | "ERROR Expected state to be END"  ; abort(); } this.state = state; break;
-	}
-}
-
-void ^?{}( dummy_t & mutex this ) {
-	set_state( this, DTOR );
-}
-
-void ?{}( dummy_t & this ) {
-	this.state = CTOR;
-}
-
-void main( dummy_t & this ) {
-	yield(random( 10 ));
-	set_state( this, MAIN );
-	waitfor( ^?{}, this ) {
-		set_state( this, AFTER );
-	}
-	set_state( this, END );
-}
-
-int main() {
-	sout | "Starting";
-	processor p;
-	for( int i = 0; i < N; i++ ){
-		dummy_t dummy[4];
-		yield( random( 100 ) );
-	}
-	sout | "Stopping";
-}
Index: tests/concurrent/waitfor/dtor.cfa
===================================================================
--- tests/concurrent/waitfor/dtor.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
+++ tests/concurrent/waitfor/dtor.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
@@ -0,0 +1,63 @@
+//---------------------------------------------------------
+// Barging test
+// Ensures the statement order is reverse when using waitfor ^?{}
+//---------------------------------------------------------
+
+#include <fstream.hfa>
+#include <kernel.hfa>
+#include <monitor.hfa>
+#include <stdlib.hfa>
+#include <thread.hfa>
+
+#include <stdbool.h>
+
+static const unsigned long N = 5_000ul;
+
+enum state_t {
+	CTOR,
+	MAIN,
+	AFTER,
+	END,
+	DTOR
+};
+
+thread dummy_t {
+	state_t state;
+};
+
+static inline void set_state( dummy_t & this, state_t state) {
+	switch(state) {
+		case CTOR  : break;
+		case MAIN  : if( this.state != CTOR  ) { serr | "ERROR Expected state to be CTOR" ; abort(); } this.state = state; break;
+		case AFTER : if( this.state != MAIN  ) { serr | "ERROR Expected state to be MAIN" ; abort(); } this.state = state; break;
+		case END   : if( this.state != AFTER ) { serr | "ERROR Expected state to be AFTER"; abort(); } this.state = state; break;
+		case DTOR  : if( this.state != END   ) { serr | "ERROR Expected state to be END"  ; abort(); } this.state = state; break;
+	}
+}
+
+void ^?{}( dummy_t & mutex this ) {
+	set_state( this, DTOR );
+}
+
+void ?{}( dummy_t & this ) {
+	this.state = CTOR;
+}
+
+void main( dummy_t & this ) {
+	yield(random( 10 ));
+	set_state( this, MAIN );
+	waitfor( ^?{}, this ) {
+		set_state( this, AFTER );
+	}
+	set_state( this, END );
+}
+
+int main() {
+	sout | "Starting";
+	processor p;
+	for( int i = 0; i < N; i++ ){
+		dummy_t dummy[4];
+		yield( random( 100 ) );
+	}
+	sout | "Stopping";
+}
Index: tests/concurrent/waitfor/else.c
===================================================================
--- tests/concurrent/waitfor/else.c	(revision d5b2ac82c5d162b3f54cf7db3bdcbb3a48149204)
+++ 	(revision )
@@ -1,48 +1,0 @@
-#include <fstream.hfa>
-#include <monitor.hfa>
-
-#include <stdbool.h>
-
-monitor M {};
-
-void notcalled( M & mutex m ) {
-	abort();
-}
-
-void test( M & mutex m ) {
-	int i = 0;
-	sout | "Starting";
-
-	when( false ) waitfor( notcalled, m );
-
-	sout | "Step" | i++;
-
-	waitfor( notcalled, m ); or else {
-		sout | "else called";
-	}
-
-	sout | "Step" | i++;
-
-	when( true ) waitfor( notcalled, m ); or when( true ) else {
-		sout | "else called";
-	}
-
-	sout | "Step" | i++;
-
-	when( false ) waitfor( notcalled, m ); or when( true ) else {
-		sout | "else called";
-	}
-
-	sout | "Step" | i++;
-
-	when( false ) waitfor( notcalled, m ); or when( false ) else {
-		sout | "else called";
-	}
-
-	sout | "Done";
-}
-
-int main() {
-	M m;
-	test(m);
-}
Index: tests/concurrent/waitfor/else.cfa
===================================================================
--- tests/concurrent/waitfor/else.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
+++ tests/concurrent/waitfor/else.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
@@ -0,0 +1,48 @@
+#include <fstream.hfa>
+#include <monitor.hfa>
+
+#include <stdbool.h>
+
+monitor M {};
+
+void notcalled( M & mutex m ) {
+	abort();
+}
+
+void test( M & mutex m ) {
+	int i = 0;
+	sout | "Starting";
+
+	when( false ) waitfor( notcalled, m );
+
+	sout | "Step" | i++;
+
+	waitfor( notcalled, m ); or else {
+		sout | "else called";
+	}
+
+	sout | "Step" | i++;
+
+	when( true ) waitfor( notcalled, m ); or when( true ) else {
+		sout | "else called";
+	}
+
+	sout | "Step" | i++;
+
+	when( false ) waitfor( notcalled, m ); or when( true ) else {
+		sout | "else called";
+	}
+
+	sout | "Step" | i++;
+
+	when( false ) waitfor( notcalled, m ); or when( false ) else {
+		sout | "else called";
+	}
+
+	sout | "Done";
+}
+
+int main() {
+	M m;
+	test(m);
+}
Index: tests/concurrent/waitfor/parse.c
===================================================================
--- tests/concurrent/waitfor/parse.c	(revision d5b2ac82c5d162b3f54cf7db3bdcbb3a48149204)
+++ 	(revision )
@@ -1,104 +1,0 @@
-//----------------------------------------------------------------------------------------
-//----------------------------------------------------------------------------------------
-//
-//		DEPRECATED TEST
-//		DIFFERS BETWEEN DEBUG AND RELEASE
-//
-//----------------------------------------------------------------------------------------
-//----------------------------------------------------------------------------------------
-
-#include <monitor.hfa>
-
-monitor M {};
-
-M a;
-
-void f1( M & mutex a );
-void f2( M & mutex a );
-void f2( M & mutex a, M & mutex b );
-void f3( M & mutex a );
-void f3( M & mutex a, M & mutex b );
-void f3( M & mutex a, M & mutex b, M & mutex c );
-
-void foo() {
-
-	//---------------------------------------
-	waitfor( f1, a ) {
-		1;
-	}
-
-	//---------------------------------------
-	waitfor( f1, a ) {
-		2;
-	}
-	waitfor( f2, a ) {
-		3;
-	}
-
-	//---------------------------------------
-	when( 1 < 3 ) waitfor( f2, a, a ) {
-		4;
-	}
-	or timeout( 100 ) {
-		5;
-	}
-
-	//---------------------------------------
-	when( 2 < 3 ) waitfor( f3, a ) {
-		5;
-	}
-	or else {
-		6;
-	}
-
-	//---------------------------------------
-	when( 3 < 3 ) waitfor( f3, a, a ) {
-		7;
-	}
-	or when( 4 < 3 ) timeout( 101 ) {
-		8;
-	}
-	or when( 5 < 3 ) else {
-		9;
-	}
-
-	//---------------------------------------
-	when( 6 < 3 ) waitfor( f3, a, a, a ) {
-		10;
-	}
- 	or when( 7 < 3 ) waitfor( f1, a  ) {
-		11;
-	}
-	or else {
-		12;
-	}
-
-	//---------------------------------------
-	when( 8 < 3 ) waitfor( f3, a, a ) {
-		13;
-	}
- 	or waitfor( f1, a  ) {
-		14;
-	}
-	or when( 9 < 3 ) timeout( 102 ) {
-		15;
-	}
-
-	//---------------------------------------
-	when( 10 < 3 ) waitfor( f1, a ) {
-		16;
-	}
- 	or waitfor( f2, a, a ) {
-		17;
-	}
-	or timeout( 103 ) {
-		18;
-	}
-	or when( 11 < 3 ) else {
-		19;
-	}
-}
-
-int main() {
-
-}
Index: tests/concurrent/waitfor/parse.cfa
===================================================================
--- tests/concurrent/waitfor/parse.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
+++ tests/concurrent/waitfor/parse.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
@@ -0,0 +1,104 @@
+//----------------------------------------------------------------------------------------
+//----------------------------------------------------------------------------------------
+//
+//		DEPRECATED TEST
+//		DIFFERS BETWEEN DEBUG AND RELEASE
+//
+//----------------------------------------------------------------------------------------
+//----------------------------------------------------------------------------------------
+
+#include <monitor.hfa>
+
+monitor M {};
+
+M a;
+
+void f1( M & mutex a );
+void f2( M & mutex a );
+void f2( M & mutex a, M & mutex b );
+void f3( M & mutex a );
+void f3( M & mutex a, M & mutex b );
+void f3( M & mutex a, M & mutex b, M & mutex c );
+
+void foo() {
+
+	//---------------------------------------
+	waitfor( f1, a ) {
+		1;
+	}
+
+	//---------------------------------------
+	waitfor( f1, a ) {
+		2;
+	}
+	waitfor( f2, a ) {
+		3;
+	}
+
+	//---------------------------------------
+	when( 1 < 3 ) waitfor( f2, a, a ) {
+		4;
+	}
+	or timeout( 100 ) {
+		5;
+	}
+
+	//---------------------------------------
+	when( 2 < 3 ) waitfor( f3, a ) {
+		5;
+	}
+	or else {
+		6;
+	}
+
+	//---------------------------------------
+	when( 3 < 3 ) waitfor( f3, a, a ) {
+		7;
+	}
+	or when( 4 < 3 ) timeout( 101 ) {
+		8;
+	}
+	or when( 5 < 3 ) else {
+		9;
+	}
+
+	//---------------------------------------
+	when( 6 < 3 ) waitfor( f3, a, a, a ) {
+		10;
+	}
+ 	or when( 7 < 3 ) waitfor( f1, a  ) {
+		11;
+	}
+	or else {
+		12;
+	}
+
+	//---------------------------------------
+	when( 8 < 3 ) waitfor( f3, a, a ) {
+		13;
+	}
+ 	or waitfor( f1, a  ) {
+		14;
+	}
+	or when( 9 < 3 ) timeout( 102 ) {
+		15;
+	}
+
+	//---------------------------------------
+	when( 10 < 3 ) waitfor( f1, a ) {
+		16;
+	}
+ 	or waitfor( f2, a, a ) {
+		17;
+	}
+	or timeout( 103 ) {
+		18;
+	}
+	or when( 11 < 3 ) else {
+		19;
+	}
+}
+
+int main() {
+
+}
Index: tests/concurrent/waitfor/parse2.c
===================================================================
--- tests/concurrent/waitfor/parse2.c	(revision d5b2ac82c5d162b3f54cf7db3bdcbb3a48149204)
+++ 	(revision )
@@ -1,249 +1,0 @@
-// 
-// Cforall Version 1.0.0 Copyright (C) 2017 University of Waterloo
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-// 
-// waitfor.c -- 
-// 
-// Author           : Peter A. Buhr
-// Created On       : Wed Aug 30 17:53:29 2017
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Wed Aug 30 17:55:17 2017
-// Update Count     : 2
-// 
-
-#include <stdbool.h>
-
-int fred() {
-	int x, z;
-
-	// test waitfor and when
-
-	waitfor( x );
-
-	waitfor( x ) {
-	}
-
-	waitfor( x, z ) {
-	}
-
-	when( true ) waitfor( x );
-
-	when( true ) waitfor( x ) {
-	}
-
-	waitfor( x );
-	or waitfor( y );
-
-	waitfor( x, z );
-	or waitfor( y );
-
-	when( true ) waitfor( x );
-	or when( true ) waitfor( y );
-
-	when( true ) waitfor( x, z );
-	or when( true ) waitfor( y );
-
-	waitfor( x ) {
-	} or waitfor( y ) {
-	}
-
-	waitfor( x, z ) {
-	} or waitfor( y ) {
-	}
-
-	when( true ) waitfor( x ) {
-	} or when( true ) waitfor( y ) {
-	}
-
-	waitfor( x );
-	or waitfor( y ) {
-	}
-
-	when( true ) waitfor( x );
-	or when( true ) waitfor( y ) {
-	}
-
-	waitfor( x ) {
-	} or waitfor( y );
-
-	when( true ) waitfor( x ) {
-	} or when( true ) waitfor( y );
-
-	// test when, waitfor and else
-
-	waitfor( x );
-	or else;
-
-	when( true ) waitfor( x );
-	or else;
-
-	when( true ) waitfor( x, z );
-	or else;
-
-	waitfor( x ) {
-	} or else {
-	}
-
-	when( true ) waitfor( x ) {
-	} or else {
-	}
-
-	waitfor( x );
-	or else {
-	}
-
-	when( true ) waitfor( x );
-	or else {
-	}
-
-	when( true ) waitfor( x, z );
-	or else {
-	}
-
-	waitfor( x ) {
-	} or else;
-
-	when( true ) waitfor( x ) {
-	} or else;
-
-	waitfor( x );
-	or when( true ) else;
-
-	when( true ) waitfor( x );
-	or when( true ) else;
-
-	when( true ) waitfor( x, z );
-	or when( true ) else;
-
-	waitfor( x ) {
-	} or when( true ) else {
-	}
-
-	when( true ) waitfor( x ) {
-	} or when( true ) else {
-	}
-
-	waitfor( x );
-	or when( true ) else {
-	}
-
-	when( true ) waitfor( x );
-	or when( true ) else {
-	}
-
-	when( true ) waitfor( x, z );
-	or when( true ) else {
-	}
-
-	waitfor( x ) {
-	} or when( true ) else;
-
-	when( true ) waitfor( x ) {
-	} or when( true ) else;
-
-	// test when, waitfor and timeout
-
-	waitfor( x );
-	or timeout( 3 );
-
-	waitfor( x, z );
-	or timeout( 3 );
-
-	when( true ) waitfor( x );
-	or timeout( 3 );
-
-	waitfor( x ) {
-	} or timeout( 3 ) {
-	}
-
-	when( true ) waitfor( x ) {
-	} or timeout( 3 ) {
-	}
-
-	when( true ) waitfor( x, z ) {
-	} or timeout( 3 ) {
-	}
-
-	when( true ) waitfor( x ) {
-	} or when ( true ) timeout( 3 ) {
-	}
-
-	when( true ) waitfor( x, z ) {
-	} or when ( true ) timeout( 3 ) {
-	}
-
-	waitfor( x );
-	or timeout( 3 ) {
-	}
-
-	when( true ) waitfor( x );
-	or timeout( 3 ) {
-	}
-
-	when( true ) waitfor( x );
-	or when( true ) timeout( 3 ) {
-	}
-
-	waitfor( x ) {
-	} or timeout( 3 );
-
-	when( true ) waitfor( x ) {
-	} or timeout( 3 );
-
-	when( true ) waitfor( x ) {
-	} or when( true ) timeout( 3 );
-
-	// test when, waitfor, timeout and else
-
-	waitfor( x ) {
-	} or timeout( 3 ) {
-	} or when( true ) else {}
-
-	when( true ) waitfor( x ) {
-	} or timeout( 3 ) {
-	} or when( true ) else {}
-
-	waitfor( x ) {
-	} or timeout( 3 ) {
-	} or when( true ) else {}
-
-	waitfor( x ) {
-	} or when( true ) timeout( 3 ) {
-	} or when( true ) else {}
-
-	when( true ) waitfor( x ) {
-	} or timeout( 3 ) {
-	} or when( true ) else {}
-
-	waitfor( x ) {
-	} or when( true ) timeout( 3 ) {
-	} or when( true ) else {}
-
-	when( true ) waitfor( x ) {
-	} or when( true ) timeout( 3 ) {
-	} or when( true ) else {}
-
-	// test quasi-keywords "or" and "timeout"
-
-	int or, timeout;
-	waitfor( timeout, 7 ) 3;
-	waitfor( timeout, 7 ) 3; or waitfor( timeout, 7 ) 3;
-	when( or ) waitfor( or, ) { 4; } or timeout( 1 ) 3;
-	when( 3 ) waitfor( or, 2 ) 4; or else 4;
-	when( 3 ) waitfor( or, 3 ) 4; or when( or ) timeout( or ) 4; or when( or ) else timeout;
-	when( 3 ) waitfor( or, or ) 3; or when( or ) waitfor( or, timeout ) 4; or else 4;
-	when( 3 ) waitfor( or, or ) 3; or waitfor( or, 9 ) 4; or when( or ) timeout( timeout ) 4;
-	when( 3 ) waitfor( or, 3 ) 3; or waitfor( or, 7 ) or; or timeout( 1 ) or; or when( 3 ) else or;
-
-	// test else selection
-
-	if ( or > timeout ) waitfor( or ) 3;
-	else waitfor( timeout ) 4;
-}
-
-// Local Variables: //
-// tab-width: 4 //
-// compile-command: "cfa waitfor.c" //
-// End: //
Index: tests/concurrent/waitfor/parse2.cfa
===================================================================
--- tests/concurrent/waitfor/parse2.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
+++ tests/concurrent/waitfor/parse2.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
@@ -0,0 +1,249 @@
+// 
+// Cforall Version 1.0.0 Copyright (C) 2017 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+// 
+// waitfor.c -- 
+// 
+// Author           : Peter A. Buhr
+// Created On       : Wed Aug 30 17:53:29 2017
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Wed Aug 30 17:55:17 2017
+// Update Count     : 2
+// 
+
+#include <stdbool.h>
+
+int fred() {
+	int x, z;
+
+	// test waitfor and when
+
+	waitfor( x );
+
+	waitfor( x ) {
+	}
+
+	waitfor( x, z ) {
+	}
+
+	when( true ) waitfor( x );
+
+	when( true ) waitfor( x ) {
+	}
+
+	waitfor( x );
+	or waitfor( y );
+
+	waitfor( x, z );
+	or waitfor( y );
+
+	when( true ) waitfor( x );
+	or when( true ) waitfor( y );
+
+	when( true ) waitfor( x, z );
+	or when( true ) waitfor( y );
+
+	waitfor( x ) {
+	} or waitfor( y ) {
+	}
+
+	waitfor( x, z ) {
+	} or waitfor( y ) {
+	}
+
+	when( true ) waitfor( x ) {
+	} or when( true ) waitfor( y ) {
+	}
+
+	waitfor( x );
+	or waitfor( y ) {
+	}
+
+	when( true ) waitfor( x );
+	or when( true ) waitfor( y ) {
+	}
+
+	waitfor( x ) {
+	} or waitfor( y );
+
+	when( true ) waitfor( x ) {
+	} or when( true ) waitfor( y );
+
+	// test when, waitfor and else
+
+	waitfor( x );
+	or else;
+
+	when( true ) waitfor( x );
+	or else;
+
+	when( true ) waitfor( x, z );
+	or else;
+
+	waitfor( x ) {
+	} or else {
+	}
+
+	when( true ) waitfor( x ) {
+	} or else {
+	}
+
+	waitfor( x );
+	or else {
+	}
+
+	when( true ) waitfor( x );
+	or else {
+	}
+
+	when( true ) waitfor( x, z );
+	or else {
+	}
+
+	waitfor( x ) {
+	} or else;
+
+	when( true ) waitfor( x ) {
+	} or else;
+
+	waitfor( x );
+	or when( true ) else;
+
+	when( true ) waitfor( x );
+	or when( true ) else;
+
+	when( true ) waitfor( x, z );
+	or when( true ) else;
+
+	waitfor( x ) {
+	} or when( true ) else {
+	}
+
+	when( true ) waitfor( x ) {
+	} or when( true ) else {
+	}
+
+	waitfor( x );
+	or when( true ) else {
+	}
+
+	when( true ) waitfor( x );
+	or when( true ) else {
+	}
+
+	when( true ) waitfor( x, z );
+	or when( true ) else {
+	}
+
+	waitfor( x ) {
+	} or when( true ) else;
+
+	when( true ) waitfor( x ) {
+	} or when( true ) else;
+
+	// test when, waitfor and timeout
+
+	waitfor( x );
+	or timeout( 3 );
+
+	waitfor( x, z );
+	or timeout( 3 );
+
+	when( true ) waitfor( x );
+	or timeout( 3 );
+
+	waitfor( x ) {
+	} or timeout( 3 ) {
+	}
+
+	when( true ) waitfor( x ) {
+	} or timeout( 3 ) {
+	}
+
+	when( true ) waitfor( x, z ) {
+	} or timeout( 3 ) {
+	}
+
+	when( true ) waitfor( x ) {
+	} or when ( true ) timeout( 3 ) {
+	}
+
+	when( true ) waitfor( x, z ) {
+	} or when ( true ) timeout( 3 ) {
+	}
+
+	waitfor( x );
+	or timeout( 3 ) {
+	}
+
+	when( true ) waitfor( x );
+	or timeout( 3 ) {
+	}
+
+	when( true ) waitfor( x );
+	or when( true ) timeout( 3 ) {
+	}
+
+	waitfor( x ) {
+	} or timeout( 3 );
+
+	when( true ) waitfor( x ) {
+	} or timeout( 3 );
+
+	when( true ) waitfor( x ) {
+	} or when( true ) timeout( 3 );
+
+	// test when, waitfor, timeout and else
+
+	waitfor( x ) {
+	} or timeout( 3 ) {
+	} or when( true ) else {}
+
+	when( true ) waitfor( x ) {
+	} or timeout( 3 ) {
+	} or when( true ) else {}
+
+	waitfor( x ) {
+	} or timeout( 3 ) {
+	} or when( true ) else {}
+
+	waitfor( x ) {
+	} or when( true ) timeout( 3 ) {
+	} or when( true ) else {}
+
+	when( true ) waitfor( x ) {
+	} or timeout( 3 ) {
+	} or when( true ) else {}
+
+	waitfor( x ) {
+	} or when( true ) timeout( 3 ) {
+	} or when( true ) else {}
+
+	when( true ) waitfor( x ) {
+	} or when( true ) timeout( 3 ) {
+	} or when( true ) else {}
+
+	// test quasi-keywords "or" and "timeout"
+
+	int or, timeout;
+	waitfor( timeout, 7 ) 3;
+	waitfor( timeout, 7 ) 3; or waitfor( timeout, 7 ) 3;
+	when( or ) waitfor( or, ) { 4; } or timeout( 1 ) 3;
+	when( 3 ) waitfor( or, 2 ) 4; or else 4;
+	when( 3 ) waitfor( or, 3 ) 4; or when( or ) timeout( or ) 4; or when( or ) else timeout;
+	when( 3 ) waitfor( or, or ) 3; or when( or ) waitfor( or, timeout ) 4; or else 4;
+	when( 3 ) waitfor( or, or ) 3; or waitfor( or, 9 ) 4; or when( or ) timeout( timeout ) 4;
+	when( 3 ) waitfor( or, 3 ) 3; or waitfor( or, 7 ) or; or timeout( 1 ) or; or when( 3 ) else or;
+
+	// test else selection
+
+	if ( or > timeout ) waitfor( or ) 3;
+	else waitfor( timeout ) 4;
+}
+
+// Local Variables: //
+// tab-width: 4 //
+// compile-command: "cfa waitfor.c" //
+// End: //
Index: tests/concurrent/waitfor/recurse.c
===================================================================
--- tests/concurrent/waitfor/recurse.c	(revision d5b2ac82c5d162b3f54cf7db3bdcbb3a48149204)
+++ 	(revision )
@@ -1,146 +1,0 @@
-//----------------------------------------------------------------
-// Recursion test
-// Ensures that proper ordering occurs between the nested waitfors
-//-----------------------------------------------------------------
-
-#include <fstream.hfa>
-#include <kernel.hfa>
-#include <monitor.hfa>
-#include <stdlib.hfa>
-#include <thread.hfa>
-
-#include <stdbool.h>
-#include <time.h>
-
-static const unsigned long N = 5_000ul;
-
-static inline void rand_yield() { yield(random( 10 )); }
-
-enum state_t { FIRST, SECOND, THIRD, LAST, STOP };
-void shuffle(enum state_t * array)
-{
-	int i;
-	for (i = 0; i < 4; i++)
-	{
-		int j = random( 4 );
-		enum state_t t = array[j];
-		array[j] = array[i];
-		array[i] = t;
-	}
-}
-
-
-monitor global_t {
-	int counter;
-	volatile bool ready;
-	state_t actions[4];
-};
-
-void ?{} ( global_t & this ) {
-	this.counter = 0;
-	this.ready = false;
-	this.actions[0] = FIRST;
-	this.actions[1] = SECOND;
-	this.actions[2] = THIRD;
-	this.actions[3] = LAST;
-	shuffle( this.actions );
-}
-
-void ^?{} ( global_t & mutex this ) {}
-
-global_t global;
-
-state_t call4( global_t & mutex this, int idx ) {
-	sout | "Last";
-
-	rand_yield();
-	this.counter++;
-	this.ready = false;
-	shuffle( this.actions );
-
-	return this.counter < N ? (state_t)this.actions[idx] : (state_t)STOP;
-}
-
-state_t call3( global_t & mutex this, int idx ) {
-	sout | "3rd";
-
-	rand_yield();
-	waitfor( call4, this );
-	rand_yield();
-
-	sout | "3rd";
-
-	return this.counter < N ? (state_t)this.actions[idx] : (state_t)STOP;
-}
-
-state_t call2( global_t & mutex this, int idx ) {
-	sout | "2nd";
-
-	rand_yield();
-	waitfor( call3, this );
-	rand_yield();
-
-	sout | "2nd";
-
-	return this.counter < N ? (state_t)this.actions[idx] : (state_t)STOP;
-}
-
-state_t call1( global_t & mutex this, int idx ) {
-	this.ready = true;
-
-	sout | this.counter | "1st";
-
-	rand_yield();
-	waitfor( call2, this );
-	rand_yield();
-
-	sout | "1st" | nl;
-
-	return this.counter < N ? (state_t)this.actions[idx] : (state_t)STOP;
-}
-
-thread waiter_t{
-	int     idx;
-	state_t state;
-};
-
-void ^?{} ( waiter_t & mutex this ) {}
-void ?{} ( waiter_t & this ) {}
-
-void ?{}( waiter_t & this, int idx, state_t state ) {
-	this.idx   = idx;
-	this.state = state;
-}
-
-
-void main( waiter_t & this ) {
-	while( this.state != STOP ) {
-		rand_yield();
-
-		switch( this.state ) {
-			case FIRST  :                                     this.state = call1( global, this.idx ); break;
-			case SECOND : while( !global.ready ) { yield(); } this.state = call2( global, this.idx ); break;
-			case THIRD  : while( !global.ready ) { yield(); } this.state = call3( global, this.idx ); break;
-			case LAST   : while( !global.ready ) { yield(); } this.state = call4( global, this.idx ); break;
-			case STOP   : serr | "This should not happen" | nl;
-		}
-	}
-}
-
-static waiter_t * volatile the_threads;
-
-int main() {
-	srandom( time(NULL) );
-	sout | nlOff;					// turn off auto newline
-	sout | "Starting" | nl;
-	{
-		waiter_t waiters[4] = {
-			{ 0, FIRST  },
-			{ 1, SECOND },
-			{ 2, THIRD  },
-			{ 3, LAST   }
-		};
-		the_threads = waiters;
-	}
-	sout | "Stopping" | nl;
-}
Index: tests/concurrent/waitfor/recurse.cfa
===================================================================
--- tests/concurrent/waitfor/recurse.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
+++ tests/concurrent/waitfor/recurse.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
@@ -0,0 +1,146 @@
+//----------------------------------------------------------------
+// Recursion test
+// Ensures that proper ordering occurs between the nested waitfors
+//-----------------------------------------------------------------
+
+#include <fstream.hfa>
+#include <kernel.hfa>
+#include <monitor.hfa>
+#include <stdlib.hfa>
+#include <thread.hfa>
+
+#include <stdbool.h>
+#include <time.h>
+
+static const unsigned long N = 5_000ul;
+
+static inline void rand_yield() { yield(random( 10 )); }
+
+enum state_t { FIRST, SECOND, THIRD, LAST, STOP };
+void shuffle(enum state_t * array)
+{
+	int i;
+	for (i = 0; i < 4; i++)
+	{
+		int j = random( 4 );
+		enum state_t t = array[j];
+		array[j] = array[i];
+		array[i] = t;
+	}
+}
+
+
+monitor global_t {
+	int counter;
+	volatile bool ready;
+	state_t actions[4];
+};
+
+void ?{} ( global_t & this ) {
+	this.counter = 0;
+	this.ready = false;
+	this.actions[0] = FIRST;
+	this.actions[1] = SECOND;
+	this.actions[2] = THIRD;
+	this.actions[3] = LAST;
+	shuffle( this.actions );
+}
+
+void ^?{} ( global_t & mutex this ) {}
+
+global_t global;
+
+state_t call4( global_t & mutex this, int idx ) {
+	sout | "Last";
+
+	rand_yield();
+	this.counter++;
+	this.ready = false;
+	shuffle( this.actions );
+
+	return this.counter < N ? (state_t)this.actions[idx] : (state_t)STOP;
+}
+
+state_t call3( global_t & mutex this, int idx ) {
+	sout | "3rd";
+
+	rand_yield();
+	waitfor( call4, this );
+	rand_yield();
+
+	sout | "3rd";
+
+	return this.counter < N ? (state_t)this.actions[idx] : (state_t)STOP;
+}
+
+state_t call2( global_t & mutex this, int idx ) {
+	sout | "2nd";
+
+	rand_yield();
+	waitfor( call3, this );
+	rand_yield();
+
+	sout | "2nd";
+
+	return this.counter < N ? (state_t)this.actions[idx] : (state_t)STOP;
+}
+
+state_t call1( global_t & mutex this, int idx ) {
+	this.ready = true;
+
+	sout | this.counter | "1st";
+
+	rand_yield();
+	waitfor( call2, this );
+	rand_yield();
+
+	sout | "1st" | nl;
+
+	return this.counter < N ? (state_t)this.actions[idx] : (state_t)STOP;
+}
+
+thread waiter_t{
+	int     idx;
+	state_t state;
+};
+
+void ^?{} ( waiter_t & mutex this ) {}
+void ?{} ( waiter_t & this ) {}
+
+void ?{}( waiter_t & this, int idx, state_t state ) {
+	this.idx   = idx;
+	this.state = state;
+}
+
+
+void main( waiter_t & this ) {
+	while( this.state != STOP ) {
+		rand_yield();
+
+		switch( this.state ) {
+			case FIRST  :                                     this.state = call1( global, this.idx ); break;
+			case SECOND : while( !global.ready ) { yield(); } this.state = call2( global, this.idx ); break;
+			case THIRD  : while( !global.ready ) { yield(); } this.state = call3( global, this.idx ); break;
+			case LAST   : while( !global.ready ) { yield(); } this.state = call4( global, this.idx ); break;
+			case STOP   : serr | "This should not happen" | nl;
+		}
+	}
+}
+
+static waiter_t * volatile the_threads;
+
+int main() {
+	srandom( time(NULL) );
+	sout | nlOff;					// turn off auto newline
+	sout | "Starting" | nl;
+	{
+		waiter_t waiters[4] = {
+			{ 0, FIRST  },
+			{ 1, SECOND },
+			{ 2, THIRD  },
+			{ 3, LAST   }
+		};
+		the_threads = waiters;
+	}
+	sout | "Stopping" | nl;
+}
Index: tests/concurrent/waitfor/simple.c
===================================================================
--- tests/concurrent/waitfor/simple.c	(revision d5b2ac82c5d162b3f54cf7db3bdcbb3a48149204)
+++ 	(revision )
@@ -1,85 +1,0 @@
-#include <fstream.hfa>
-#include <kernel.hfa>
-#include <monitor.hfa>
-#include <stdlib.hfa>
-#include <thread.hfa>
-
-#include <time.h>
-
-static const unsigned long N = 500ul;
-
-#ifndef PREEMPTION_RATE
-#define PREEMPTION_RATE 10`ms
-#endif
-
-Duration default_preemption() {
-	return PREEMPTION_RATE;
-}
-
-monitor global_t {};
-
-global_t globalA;
-
-thread Acceptor {};
-thread Acceptee {};
-
-volatile bool done;
-
-//----------------------------------------------------------------------------------------------------
-// Acceptor
-void do_notify( global_t * mutex a );
-
-void do_wait( global_t * mutex a ) {
-	sout | "Waiting to accept";
-	yield( random( 10 ) );
-
-	sout | "Accepting";
-
-	__acceptable_t acceptable;
-	acceptable.func          = (fptr_t)do_notify;
-	acceptable.count         = 1;
-	acceptable.monitors      = &a;
-
-	__waitfor_internal( 1, &acceptable );
-
-	sout | "Accepted";
-	yield( random( 10 ) );
-}
-
-void main( Acceptor* this ) {
-	for( int i = 0; i < N; i++ ) {
-		do_wait( &globalA );
-		sout | i;
-	}
-
-	done = true;
-}
-
-//----------------------------------------------------------------------------------------------------
-// Acceptee
-void do_notify( global_t * mutex a ) {
-
-}
-
-void main( Acceptee* this ) {
-	while( !done ) {
-		yield( random( 10 ) );
-		do_notify( &globalA );
-		yield( random( 10 ) );
-	}
-}
-
-//----------------------------------------------------------------------------------------------------
-// Main
-int main(int argc, char* argv[]) {
-	done = false;
-	srandom( time( NULL ) );
-	printf("%p\n", &globalA);
-	sout | "Starting";
-	{
-		Acceptor r;
-		Acceptee e[13];
-
-	}
-	sout | "Done";
-}
Index: tests/concurrent/waitfor/simple.cfa
===================================================================
--- tests/concurrent/waitfor/simple.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
+++ tests/concurrent/waitfor/simple.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
@@ -0,0 +1,85 @@
+#include <fstream.hfa>
+#include <kernel.hfa>
+#include <monitor.hfa>
+#include <stdlib.hfa>
+#include <thread.hfa>
+
+#include <time.h>
+
+static const unsigned long N = 500ul;
+
+#ifndef PREEMPTION_RATE
+#define PREEMPTION_RATE 10`ms
+#endif
+
+Duration default_preemption() {
+	return PREEMPTION_RATE;
+}
+
+monitor global_t {};
+
+global_t globalA;
+
+thread Acceptor {};
+thread Acceptee {};
+
+volatile bool done;
+
+//----------------------------------------------------------------------------------------------------
+// Acceptor
+void do_notify( global_t * mutex a );
+
+void do_wait( global_t * mutex a ) {
+	sout | "Waiting to accept";
+	yield( random( 10 ) );
+
+	sout | "Accepting";
+
+	__acceptable_t acceptable;
+	acceptable.func          = (fptr_t)do_notify;
+	acceptable.count         = 1;
+	acceptable.monitors      = &a;
+
+	__waitfor_internal( 1, &acceptable );
+
+	sout | "Accepted";
+	yield( random( 10 ) );
+}
+
+void main( Acceptor* this ) {
+	for( int i = 0; i < N; i++ ) {
+		do_wait( &globalA );
+		sout | i;
+	}
+
+	done = true;
+}
+
+//----------------------------------------------------------------------------------------------------
+// Acceptee
+void do_notify( global_t * mutex a ) {
+
+}
+
+void main( Acceptee* this ) {
+	while( !done ) {
+		yield( random( 10 ) );
+		do_notify( &globalA );
+		yield( random( 10 ) );
+	}
+}
+
+//----------------------------------------------------------------------------------------------------
+// Main
+int main(int argc, char* argv[]) {
+	done = false;
+	srandom( time( NULL ) );
+	printf("%p\n", &globalA);
+	sout | "Starting";
+	{
+		Acceptor r;
+		Acceptee e[13];
+
+	}
+	sout | "Done";
+}
Index: tests/concurrent/waitfor/statment.c
===================================================================
--- tests/concurrent/waitfor/statment.c	(revision d5b2ac82c5d162b3f54cf7db3bdcbb3a48149204)
+++ 	(revision )
@@ -1,136 +1,0 @@
-#include <fstream.hfa>
-#include <kernel.hfa>
-#include <monitor.hfa>
-#include <thread.hfa>
-
-#include <stdbool.h>
-
-monitor M {
-	int index;
-	int last_val;
-	int calls[7];
-};
-
-volatile bool start = false;
-
-void ?{}( M & this ) {
-	this.index = 0;
-	this.last_val = 0;
-	for( int i = 0; i < 7; i++ ) {
-		this.calls[i] = 100; //10_000;
-	}
-}
-
-void ^?{} ( M &  mutex this ) {}
-
-int get_index( M & mutex this ) {
-	this.index += 1;
-	return this.index;
-}
-
-bool call1( M & mutex this ) {
-	this.last_val = 1;
-	this.calls[0] -= 1;
-	return this.calls[0] > 0;
-}
-
-bool call2( M & mutex this ) {
-	this.last_val = 2;
-	this.calls[1] -= 1;
-	return this.calls[1] > 0;
-}
-
-bool call3( M & mutex this ) {
-	this.last_val = 3;
-	this.calls[2] -= 1;
-	return this.calls[2] > 0;
-}
-
-bool call4( M & mutex this ) {
-	this.last_val = 4;
-	this.calls[3] -= 1;
-	return this.calls[3] > 0;
-}
-
-bool call5( M & mutex this ) {
-	this.last_val = 5;
-	this.calls[4] -= 1;
-	return this.calls[4] > 0;
-}
-
-bool call6( M & mutex this ) {
-	this.last_val = 6;
-	this.calls[5] -= 1;
-	return this.calls[5] > 0;
-}
-
-bool call7( M & mutex this ) {
-	this.last_val = 7;
-	this.calls[6] -= 1;
-	return this.calls[6] > 0;
-}
-
-M m;
-thread caller{};
-
-bool call( int index ) {
-	switch( index ) {
-		case 1: return call1( m );
-		case 2: return call2( m );
-		case 3: return call3( m );
-		case 4: return call4( m );
-		case 5: return call5( m );
-		case 6: return call6( m );
-		case 7: return call7( m );
-		default :
-			serr | "Incorrect index" | index;
-			abort();
-	}
-}
-
-void main( caller & this ) {
-	int index = get_index( m );
-	while( !start ) yield();
-	while( call( index ) );
-}
-
-void do_wait( M & mutex this ) {
-	bool done = false;
-
-	start = true;
-
-	while( !done ) {
-		   waitfor( get_index, this );
-		or waitfor( call1, this ) { sout | "Statement"; if( this.last_val != 1 ) { serr | "Incorrect index: expected" | 1 | "got" | this.last_val; } }
-		or waitfor( call2, this ) { sout | "Statement"; if( this.last_val != 2 ) { serr | "Incorrect index: expected" | 2 | "got" | this.last_val; } }
-		or waitfor( call3, this ) { sout | "Statement"; if( this.last_val != 3 ) { serr | "Incorrect index: expected" | 3 | "got" | this.last_val; } }
-		or waitfor( call4, this ) { sout | "Statement"; if( this.last_val != 4 ) { serr | "Incorrect index: expected" | 4 | "got" | this.last_val; } }
-		or waitfor( call5, this ) { sout | "Statement"; if( this.last_val != 5 ) { serr | "Incorrect index: expected" | 5 | "got" | this.last_val; } }
-		or waitfor( call6, this ) { sout | "Statement"; if( this.last_val != 6 ) { serr | "Incorrect index: expected" | 6 | "got" | this.last_val; } }
-		or waitfor( call7, this ) { sout | "Statement"; if( this.last_val != 7 ) { serr | "Incorrect index: expected" | 7 | "got" | this.last_val; } }
-
-		done = true;
-		for( int i = 0; i < 7; i++ ) {
-			if( this.calls[i] > 0 ) {
-				done = false;
-				break;
-			}
-		}
-	}
-}
-
-thread waiter{};
-
-void main( waiter & this ) {
-	do_wait( m );
-}
-
-int main() {
-	processor p[2];
-	sout | "Starting";
-	{
-		caller c[7];
-		waiter w;
-	}
-	sout | "Stopping";
-}
Index: tests/concurrent/waitfor/statment.cfa
===================================================================
--- tests/concurrent/waitfor/statment.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
+++ tests/concurrent/waitfor/statment.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
@@ -0,0 +1,136 @@
+#include <fstream.hfa>
+#include <kernel.hfa>
+#include <monitor.hfa>
+#include <thread.hfa>
+
+#include <stdbool.h>
+
+monitor M {
+	int index;
+	int last_val;
+	int calls[7];
+};
+
+volatile bool start = false;
+
+void ?{}( M & this ) {
+	this.index = 0;
+	this.last_val = 0;
+	for( int i = 0; i < 7; i++ ) {
+		this.calls[i] = 100; //10_000;
+	}
+}
+
+void ^?{} ( M &  mutex this ) {}
+
+int get_index( M & mutex this ) {
+	this.index += 1;
+	return this.index;
+}
+
+bool call1( M & mutex this ) {
+	this.last_val = 1;
+	this.calls[0] -= 1;
+	return this.calls[0] > 0;
+}
+
+bool call2( M & mutex this ) {
+	this.last_val = 2;
+	this.calls[1] -= 1;
+	return this.calls[1] > 0;
+}
+
+bool call3( M & mutex this ) {
+	this.last_val = 3;
+	this.calls[2] -= 1;
+	return this.calls[2] > 0;
+}
+
+bool call4( M & mutex this ) {
+	this.last_val = 4;
+	this.calls[3] -= 1;
+	return this.calls[3] > 0;
+}
+
+bool call5( M & mutex this ) {
+	this.last_val = 5;
+	this.calls[4] -= 1;
+	return this.calls[4] > 0;
+}
+
+bool call6( M & mutex this ) {
+	this.last_val = 6;
+	this.calls[5] -= 1;
+	return this.calls[5] > 0;
+}
+
+bool call7( M & mutex this ) {
+	this.last_val = 7;
+	this.calls[6] -= 1;
+	return this.calls[6] > 0;
+}
+
+M m;
+thread caller{};
+
+bool call( int index ) {
+	switch( index ) {
+		case 1: return call1( m );
+		case 2: return call2( m );
+		case 3: return call3( m );
+		case 4: return call4( m );
+		case 5: return call5( m );
+		case 6: return call6( m );
+		case 7: return call7( m );
+		default :
+			serr | "Incorrect index" | index;
+			abort();
+	}
+}
+
+void main( caller & this ) {
+	int index = get_index( m );
+	while( !start ) yield();
+	while( call( index ) );
+}
+
+void do_wait( M & mutex this ) {
+	bool done = false;
+
+	start = true;
+
+	while( !done ) {
+		   waitfor( get_index, this );
+		or waitfor( call1, this ) { sout | "Statement"; if( this.last_val != 1 ) { serr | "Incorrect index: expected" | 1 | "got" | this.last_val; } }
+		or waitfor( call2, this ) { sout | "Statement"; if( this.last_val != 2 ) { serr | "Incorrect index: expected" | 2 | "got" | this.last_val; } }
+		or waitfor( call3, this ) { sout | "Statement"; if( this.last_val != 3 ) { serr | "Incorrect index: expected" | 3 | "got" | this.last_val; } }
+		or waitfor( call4, this ) { sout | "Statement"; if( this.last_val != 4 ) { serr | "Incorrect index: expected" | 4 | "got" | this.last_val; } }
+		or waitfor( call5, this ) { sout | "Statement"; if( this.last_val != 5 ) { serr | "Incorrect index: expected" | 5 | "got" | this.last_val; } }
+		or waitfor( call6, this ) { sout | "Statement"; if( this.last_val != 6 ) { serr | "Incorrect index: expected" | 6 | "got" | this.last_val; } }
+		or waitfor( call7, this ) { sout | "Statement"; if( this.last_val != 7 ) { serr | "Incorrect index: expected" | 7 | "got" | this.last_val; } }
+
+		done = true;
+		for( int i = 0; i < 7; i++ ) {
+			if( this.calls[i] > 0 ) {
+				done = false;
+				break;
+			}
+		}
+	}
+}
+
+thread waiter{};
+
+void main( waiter & this ) {
+	do_wait( m );
+}
+
+int main() {
+	processor p[2];
+	sout | "Starting";
+	{
+		caller c[7];
+		waiter w;
+	}
+	sout | "Stopping";
+}
Index: tests/concurrent/waitfor/when.c
===================================================================
--- tests/concurrent/waitfor/when.c	(revision d5b2ac82c5d162b3f54cf7db3bdcbb3a48149204)
+++ 	(revision )
@@ -1,87 +1,0 @@
-//----------------------------------------------------------------
-// When test
-// Ensures that when clauses on waitfor are respected
-//-----------------------------------------------------------------
-
-#include <fstream.hfa>
-#include <kernel.hfa>
-#include <monitor.hfa>
-#include <stdlib.hfa>
-#include <thread.hfa>
-
-#include <stdbool.h>
-#include <time.h>
-
-static const unsigned long N = 4_998ul;
-
-static inline void rand_yield() { yield(random( 10 )); }
-
-monitor global_t {
-	int last_call;
-	bool done;
-};
-
-void ?{} ( global_t & this ) {
-	this.last_call = 6;
-	this.done = false;
-}
-
-void ^?{} ( global_t & mutex this ) {}
-
-global_t global;
-
-bool call1( global_t & mutex this ) { this.last_call = 1; return this.done; }
-bool call2( global_t & mutex this ) { this.last_call = 2; return this.done; }
-bool call3( global_t & mutex this ) { this.last_call = 3; return this.done; }
-bool call4( global_t & mutex this ) { this.last_call = 4; return this.done; }
-bool call5( global_t & mutex this ) { this.last_call = 5; return this.done; }
-bool call6( global_t & mutex this ) { this.last_call = 6; return this.done; }
-
-thread caller_t{};
-void main( caller_t & this ) {
-	while( true ) {
-		rand_yield();
-		if( call1( global ) ) return;
-		rand_yield();
-		if( call2( global ) ) return;
-		rand_yield();
-		if( call3( global ) ) return;
-		rand_yield();
-		if( call4( global ) ) return;
-		rand_yield();
-		if( call5( global ) ) return;
-		rand_yield();
-		if( call6( global ) ) return;
-	}
-}
-
-void arbiter( global_t & mutex this ) {
-	for( int i = 0; i < N; i++ ) {
-		   when( this.last_call == 6 ) waitfor( call1, this ) { if( this.last_call != 1) { serr | "Expected last_call to be 1 got" | this.last_call; } }
-		or when( this.last_call == 1 ) waitfor( call2, this ) { if( this.last_call != 2) { serr | "Expected last_call to be 2 got" | this.last_call; } }
-		or when( this.last_call == 2 ) waitfor( call3, this ) { if( this.last_call != 3) { serr | "Expected last_call to be 3 got" | this.last_call; } }
-		or when( this.last_call == 3 ) waitfor( call4, this ) { if( this.last_call != 4) { serr | "Expected last_call to be 4 got" | this.last_call; } }
-		or when( this.last_call == 4 ) waitfor( call5, this ) { if( this.last_call != 5) { serr | "Expected last_call to be 5 got" | this.last_call; } }
-		or when( this.last_call == 5 ) waitfor( call6, this ) { if( this.last_call != 6) { serr | "Expected last_call to be 6 got" | this.last_call; } }
-
-		sout | this.last_call;
-	}
-
-	this.done = true;
-}
-
-thread arbiter_t{};
-void main( arbiter_t & this ) {
-	arbiter( global );
-}
-
-int main() {
-	srandom( time(NULL) );
-	sout | "Starting";
-	{
-		arbiter_t arbiter;
-		caller_t callers[7];
-
-	}
-	sout | "Stopping";
-}
Index: tests/concurrent/waitfor/when.cfa
===================================================================
--- tests/concurrent/waitfor/when.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
+++ tests/concurrent/waitfor/when.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
@@ -0,0 +1,87 @@
+//----------------------------------------------------------------
+// When test
+// Ensures that when clauses on waitfor are respected
+//-----------------------------------------------------------------
+
+#include <fstream.hfa>
+#include <kernel.hfa>
+#include <monitor.hfa>
+#include <stdlib.hfa>
+#include <thread.hfa>
+
+#include <stdbool.h>
+#include <time.h>
+
+static const unsigned long N = 4_998ul;
+
+static inline void rand_yield() { yield(random( 10 )); }
+
+monitor global_t {
+	int last_call;
+	bool done;
+};
+
+void ?{} ( global_t & this ) {
+	this.last_call = 6;
+	this.done = false;
+}
+
+void ^?{} ( global_t & mutex this ) {}
+
+global_t global;
+
+bool call1( global_t & mutex this ) { this.last_call = 1; return this.done; }
+bool call2( global_t & mutex this ) { this.last_call = 2; return this.done; }
+bool call3( global_t & mutex this ) { this.last_call = 3; return this.done; }
+bool call4( global_t & mutex this ) { this.last_call = 4; return this.done; }
+bool call5( global_t & mutex this ) { this.last_call = 5; return this.done; }
+bool call6( global_t & mutex this ) { this.last_call = 6; return this.done; }
+
+thread caller_t{};
+void main( caller_t & this ) {
+	while( true ) {
+		rand_yield();
+		if( call1( global ) ) return;
+		rand_yield();
+		if( call2( global ) ) return;
+		rand_yield();
+		if( call3( global ) ) return;
+		rand_yield();
+		if( call4( global ) ) return;
+		rand_yield();
+		if( call5( global ) ) return;
+		rand_yield();
+		if( call6( global ) ) return;
+	}
+}
+
+void arbiter( global_t & mutex this ) {
+	for( int i = 0; i < N; i++ ) {
+		   when( this.last_call == 6 ) waitfor( call1, this ) { if( this.last_call != 1) { serr | "Expected last_call to be 1 got" | this.last_call; } }
+		or when( this.last_call == 1 ) waitfor( call2, this ) { if( this.last_call != 2) { serr | "Expected last_call to be 2 got" | this.last_call; } }
+		or when( this.last_call == 2 ) waitfor( call3, this ) { if( this.last_call != 3) { serr | "Expected last_call to be 3 got" | this.last_call; } }
+		or when( this.last_call == 3 ) waitfor( call4, this ) { if( this.last_call != 4) { serr | "Expected last_call to be 4 got" | this.last_call; } }
+		or when( this.last_call == 4 ) waitfor( call5, this ) { if( this.last_call != 5) { serr | "Expected last_call to be 5 got" | this.last_call; } }
+		or when( this.last_call == 5 ) waitfor( call6, this ) { if( this.last_call != 6) { serr | "Expected last_call to be 6 got" | this.last_call; } }
+
+		sout | this.last_call;
+	}
+
+	this.done = true;
+}
+
+thread arbiter_t{};
+void main( arbiter_t & this ) {
+	arbiter( global );
+}
+
+int main() {
+	srandom( time(NULL) );
+	sout | "Starting";
+	{
+		arbiter_t arbiter;
+		caller_t callers[7];
+
+	}
+	sout | "Stopping";
+}
Index: tests/coroutine/fibonacci.c
===================================================================
--- tests/coroutine/fibonacci.c	(revision d5b2ac82c5d162b3f54cf7db3bdcbb3a48149204)
+++ 	(revision )
@@ -1,48 +1,0 @@
-//
-// Cforall Version 1.0.0 Copyright (C) 2017 University of Waterloo
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-//
-// fibonacci.c -- 3-state finite-state machine
-//
-// Author           : Thierry Delisle
-// Created On       : Thu Jun  8 07:29:37 2017
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Tue Dec 11 21:57:33 2018
-// Update Count     : 25
-//
-
-#include <fstream.hfa>
-#include <coroutine.hfa>
-
-coroutine Fibonacci { int fn; };						// used for communication
-
-void main( Fibonacci & fib ) with( fib ) {				// called on first resume
-	int fn1, fn2;										// retained between resumes
-	fn = 0;  fn1 = fn;									// 1st case
-	suspend();											// restart last resume
-	fn = 1;  fn2 = fn1;  fn1 = fn;						// 2nd case
-	suspend();											// restart last resume
-	for () {
-		fn = fn1 + fn2;  fn2 = fn1;  fn1 = fn;			// general case
-		suspend();										// restart last resume
-	} // for
-}
-
-int next( Fibonacci & fib ) with( fib ) {
-	resume( fib );										// restart last suspend
-	return fn;
-}
-
-int main() {
-	Fibonacci f1, f2;
-	for ( 10 ) {										// print N Fibonacci values
-		sout | next( f1 ) | next( f2 );
-	} // for
-}
-
-// Local Variables: //
-// tab-width: 4 //
-// compile-command: "cfa fibonacci.c" //
-// End: //
Index: tests/coroutine/fibonacci.cfa
===================================================================
--- tests/coroutine/fibonacci.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
+++ tests/coroutine/fibonacci.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
@@ -0,0 +1,48 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2017 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// fibonacci.c -- 3-state finite-state machine
+//
+// Author           : Thierry Delisle
+// Created On       : Thu Jun  8 07:29:37 2017
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Tue Dec 11 21:57:33 2018
+// Update Count     : 25
+//
+
+#include <fstream.hfa>
+#include <coroutine.hfa>
+
+coroutine Fibonacci { int fn; };						// used for communication
+
+void main( Fibonacci & fib ) with( fib ) {				// called on first resume
+	int fn1, fn2;										// retained between resumes
+	fn = 0;  fn1 = fn;									// 1st case
+	suspend();											// restart last resume
+	fn = 1;  fn2 = fn1;  fn1 = fn;						// 2nd case
+	suspend();											// restart last resume
+	for () {
+		fn = fn1 + fn2;  fn2 = fn1;  fn1 = fn;			// general case
+		suspend();										// restart last resume
+	} // for
+}
+
+int next( Fibonacci & fib ) with( fib ) {
+	resume( fib );										// restart last suspend
+	return fn;
+}
+
+int main() {
+	Fibonacci f1, f2;
+	for ( 10 ) {										// print N Fibonacci values
+		sout | next( f1 ) | next( f2 );
+	} // for
+}
+
+// Local Variables: //
+// tab-width: 4 //
+// compile-command: "cfa fibonacci.c" //
+// End: //
Index: tests/coroutine/fibonacci_1.c
===================================================================
--- tests/coroutine/fibonacci_1.c	(revision d5b2ac82c5d162b3f54cf7db3bdcbb3a48149204)
+++ 	(revision )
@@ -1,45 +1,0 @@
-//
-// Cforall Version 1.0.0 Copyright (C) 2018 University of Waterloo
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-//
-// fibonacci_1.c -- 1-state finite-state machine: precomputed first two states returning f(n - 2)
-//
-// Author           : Peter A. Buhr
-// Created On       : Thu Apr 26 23:20:08 2018
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Tue Dec 11 21:57:54 2018
-// Update Count     : 14
-// 
-
-#include <fstream.hfa>
-#include <coroutine.hfa>
-
-coroutine Fibonacci { int ret; };						// used for communication
-
-void main( Fibonacci & fib ) with( fib ) {				// called on first resume
-	int fn, fn1 = 1, fn2 = 0;							// precompute first two states
-	for () {
-		ret = fn2;
-		fn = fn1 + fn2;  fn2 = fn1;  fn1 = fn;			// general case
-		suspend();										// restart last resume
-	} // for
-}
-
-int next( Fibonacci & fib ) with( fib ) {
-	resume( fib );										// restart last suspend
-	return ret;
-}
-
-int main() {
-	Fibonacci f1, f2;
-	for ( 10 ) {										// print N Fibonacci values
-		sout | next( f1 ) | next( f2 );
-	} // for
-}
-
-// Local Variables: //
-// tab-width: 4 //
-// compile-command: "cfa fibonacci_1.c" //
-// End: //
Index: tests/coroutine/fibonacci_1.cfa
===================================================================
--- tests/coroutine/fibonacci_1.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
+++ tests/coroutine/fibonacci_1.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
@@ -0,0 +1,45 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2018 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// fibonacci_1.c -- 1-state finite-state machine: precomputed first two states returning f(n - 2)
+//
+// Author           : Peter A. Buhr
+// Created On       : Thu Apr 26 23:20:08 2018
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Tue Dec 11 21:57:54 2018
+// Update Count     : 14
+// 
+
+#include <fstream.hfa>
+#include <coroutine.hfa>
+
+coroutine Fibonacci { int ret; };						// used for communication
+
+void main( Fibonacci & fib ) with( fib ) {				// called on first resume
+	int fn, fn1 = 1, fn2 = 0;							// precompute first two states
+	for () {
+		ret = fn2;
+		fn = fn1 + fn2;  fn2 = fn1;  fn1 = fn;			// general case
+		suspend();										// restart last resume
+	} // for
+}
+
+int next( Fibonacci & fib ) with( fib ) {
+	resume( fib );										// restart last suspend
+	return ret;
+}
+
+int main() {
+	Fibonacci f1, f2;
+	for ( 10 ) {										// print N Fibonacci values
+		sout | next( f1 ) | next( f2 );
+	} // for
+}
+
+// Local Variables: //
+// tab-width: 4 //
+// compile-command: "cfa fibonacci_1.c" //
+// End: //
Index: tests/coroutine/fmtLines.c
===================================================================
--- tests/coroutine/fmtLines.c	(revision d5b2ac82c5d162b3f54cf7db3bdcbb3a48149204)
+++ 	(revision )
@@ -1,66 +1,0 @@
-//
-// Cforall Version 1.0.0 Copyright (C) 2017 University of Waterloo
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-//
-// fmtLines.cc -- format characters into blocks of 4 and groups of 5 blocks per line
-//
-// Author           : Peter A. Buhr
-// Created On       : Sun Sep 17 21:56:15 2017
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Sat Dec 22 18:27:00 2018
-// Update Count     : 57
-//
-
-#include <fstream.hfa>
-#include <coroutine.hfa>
-
-coroutine Format {
-	char ch;											// used for communication
-	int g, b;											// global because used in destructor
-};
-
-void main( Format & fmt ) with( fmt ) {
-	for () {											// for as many characters
-		for ( g = 0; g < 5; g += 1 ) {					// groups of 5 blocks
-			for ( b = 0; b < 4; b += 1 ) {				// blocks of 4 characters
-				for () {								// for newline characters
-					suspend();
-				  if ( ch != '\n' ) break;				// ignore newline
-				} // for
-				sout | ch;								// print character
-			} // for
-			sout | "  ";								// print block separator
-		} // for
-		sout | nl;										// print group separator
-	} // for
-} // main
-
-void ?{}( Format & fmt ) {
-	resume( fmt );										// prime (start) coroutine
-}
-
-void ^?{}( Format & fmt ) with( fmt ) {
-	if ( g != 0 || b != 0 ) sout | nl;
-}
-
-void format( Format & fmt ) {
-	resume( fmt );
-} // format
-
-int main() {
-	Format fmt;
-	sout | nlOff;										// turn off auto newline
-
-  eof: for () {											// read until end of file
-		sin | fmt.ch;									// read one character
-	  if ( eof( sin ) ) break eof;						// eof ?
-		format( fmt );									// push character for formatting
-	} // for
-} // main
-
-// Local Variables: //
-// tab-width: 4 //
-// compile-command: "cfa fmtLines.c" //
-// End: //
Index: tests/coroutine/fmtLines.cfa
===================================================================
--- tests/coroutine/fmtLines.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
+++ tests/coroutine/fmtLines.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
@@ -0,0 +1,66 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2017 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// fmtLines.cc -- format characters into blocks of 4 and groups of 5 blocks per line
+//
+// Author           : Peter A. Buhr
+// Created On       : Sun Sep 17 21:56:15 2017
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Sat Dec 22 18:27:00 2018
+// Update Count     : 57
+//
+
+#include <fstream.hfa>
+#include <coroutine.hfa>
+
+coroutine Format {
+	char ch;											// used for communication
+	int g, b;											// global because used in destructor
+};
+
+void main( Format & fmt ) with( fmt ) {
+	for () {											// for as many characters
+		for ( g = 0; g < 5; g += 1 ) {					// groups of 5 blocks
+			for ( b = 0; b < 4; b += 1 ) {				// blocks of 4 characters
+				for () {								// for newline characters
+					suspend();
+				  if ( ch != '\n' ) break;				// ignore newline
+				} // for
+				sout | ch;								// print character
+			} // for
+			sout | "  ";								// print block separator
+		} // for
+		sout | nl;										// print group separator
+	} // for
+} // main
+
+void ?{}( Format & fmt ) {
+	resume( fmt );										// prime (start) coroutine
+}
+
+void ^?{}( Format & fmt ) with( fmt ) {
+	if ( g != 0 || b != 0 ) sout | nl;
+}
+
+void format( Format & fmt ) {
+	resume( fmt );
+} // format
+
+int main() {
+	Format fmt;
+	sout | nlOff;										// turn off auto newline
+
+  eof: for () {											// read until end of file
+		sin | fmt.ch;									// read one character
+	  if ( eof( sin ) ) break eof;						// eof ?
+		format( fmt );									// push character for formatting
+	} // for
+} // main
+
+// Local Variables: //
+// tab-width: 4 //
+// compile-command: "cfa fmtLines.c" //
+// End: //
Index: tests/coroutine/pingpong.c
===================================================================
--- tests/coroutine/pingpong.c	(revision d5b2ac82c5d162b3f54cf7db3bdcbb3a48149204)
+++ 	(revision )
@@ -1,55 +1,0 @@
-//
-// Cforall Version 1.0.0 Copyright (C) 2017 University of Waterloo
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-//
-// pingpong.c --
-//
-// Author           : Peter A. Buhr
-// Created On       : Wed Sep 20 11:55:23 2017
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Tue Dec 11 21:58:06 2018
-// Update Count     : 29
-//
-
-#include <coroutine.hfa>
-#include <fstream.hfa>
-
-coroutine PingPong {
-	const char * name;
-	/* const */ unsigned int N;
-	PingPong * part;
-};
-
-void ?{}( PingPong & this, const char * name, unsigned int N, PingPong & part ) {
-	this.name = name;
-	this.N = N;
-	this.part = &part;
-}
-void ?{}( PingPong & this, const char * name, unsigned int N ) {
-	this{ name, N, *(PingPong *)0 };
-}
-void cycle( PingPong & pingpong ) {
-	resume( pingpong );
-}
-void partner( PingPong & this, PingPong & part ) {
-	this.part = &part;
-	resume( this );
-}
-void main( PingPong & pingpong ) {						// ping's starter ::main, pong's starter ping
-	for ( pingpong.N ) {								// N ping-pongs
-		sout | pingpong.name;
-		cycle( *pingpong.part );
-	} // for
-}
-int main() {
-	enum { N = 20 };
-	PingPong ping = { "ping", N }, pong = { "pong", N, ping };
-	partner( ping, pong );
-}
-
-// Local Variables: //
-// tab-width: 4 //
-// compile-command: "cfa pingpong.c" //
-// End: //
Index: tests/coroutine/pingpong.cfa
===================================================================
--- tests/coroutine/pingpong.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
+++ tests/coroutine/pingpong.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
@@ -0,0 +1,55 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2017 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// pingpong.c --
+//
+// Author           : Peter A. Buhr
+// Created On       : Wed Sep 20 11:55:23 2017
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Tue Dec 11 21:58:06 2018
+// Update Count     : 29
+//
+
+#include <coroutine.hfa>
+#include <fstream.hfa>
+
+coroutine PingPong {
+	const char * name;
+	/* const */ unsigned int N;
+	PingPong * part;
+};
+
+void ?{}( PingPong & this, const char * name, unsigned int N, PingPong & part ) {
+	this.name = name;
+	this.N = N;
+	this.part = &part;
+}
+void ?{}( PingPong & this, const char * name, unsigned int N ) {
+	this{ name, N, *(PingPong *)0 };
+}
+void cycle( PingPong & pingpong ) {
+	resume( pingpong );
+}
+void partner( PingPong & this, PingPong & part ) {
+	this.part = &part;
+	resume( this );
+}
+void main( PingPong & pingpong ) {						// ping's starter ::main, pong's starter ping
+	for ( pingpong.N ) {								// N ping-pongs
+		sout | pingpong.name;
+		cycle( *pingpong.part );
+	} // for
+}
+int main() {
+	enum { N = 20 };
+	PingPong ping = { "ping", N }, pong = { "pong", N, ping };
+	partner( ping, pong );
+}
+
+// Local Variables: //
+// tab-width: 4 //
+// compile-command: "cfa pingpong.c" //
+// End: //
Index: tests/coroutine/prodcons.c
===================================================================
--- tests/coroutine/prodcons.c	(revision d5b2ac82c5d162b3f54cf7db3bdcbb3a48149204)
+++ 	(revision )
@@ -1,94 +1,0 @@
-//
-// Cforall Version 1.0.0 Copyright (C) 2017 University of Waterloo
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-//
-// prodcons.c --
-//
-// Author           : Peter A. Buhr
-// Created On       : Mon Sep 18 12:23:39 2017
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Wed Dec 12 23:04:49 2018
-// Update Count     : 53
-//
-
-#include <fstream.hfa>
-#include <coroutine.hfa>
-#include <stdlib.hfa>									// random
-#include <unistd.h>										// getpid
-
-coroutine Cons;											// forward
-int delivery( Cons & cons, int p1, int p2 );
-void stop( Cons & cons );
-
-coroutine Prod {
-	Cons & c;
-	int N, money, receipt;
-};
-void main( Prod & prod ) with( prod ) {					// starter ::main
-	// 1st resume starts here
-	for ( i; N ) {										// N pairs of values
-		int p1 = random( 100 ), p2 = random( 100 );
-		sout | p1 | " " | p2;
-		int status = delivery( c, p1, p2 );
-		sout | " $" | money | nl | status;
-		receipt += 1;
-	}
-	stop( c );
-	sout | "prod stops";
-}
-int payment( Prod & prod, int money ) {
-	prod.money = money;
-	resume( prod );										// main 1st time, then
-	return prod.receipt;								// prod in delivery
-}
-void start( Prod & prod, int N, Cons &c ) {
-	&prod.c = &c;
-	prod.[N, receipt] = [N, 0];
-	resume( prod );										// activate main
-}
-
-coroutine Cons {
-	Prod & p;
-	int p1, p2, status;
-	bool done;
-};
-void ?{}( Cons & cons, Prod & p ) {
-	&cons.p = &p;
-	cons.[status, done ] = [0, false];
-}
-void ^?{}( Cons & cons ) {}
-void main( Cons & cons ) with( cons ) {					// starter prod
-	// 1st resume starts here
-	int money = 1, receipt;
-	for ( ; ! done; ) {
-		sout | p1 | " " | p2 | nl | " $" | money;
-		status += 1;
-		receipt = payment( p, money );
-		sout | " #" | receipt;
-		money += 1;
-	}
-	sout | "cons stops";
-}
-int delivery( Cons & cons, int p1, int p2 ) {
-	cons.[p1, p2] = [p1, p2];
-	resume( cons );										// main 1st time, then
-	return cons.status;									// cons in payment
-}
-void stop( Cons & cons ) {
-	cons.done = true;
-	resume( cons );										// activate payment
-}
-int main() {
-	Prod prod;
-	Cons cons = { prod };
-	srandom( /* getpid() */ 103 );						// fixed seed for testing
-	start( prod, 5, cons );
-	sout | "main stops";
-}
-
-// Local Variables: //
-// tab-width: 4 //
-// compile-command: "cfa prodcons.c" //
-// End: //
Index: tests/coroutine/prodcons.cfa
===================================================================
--- tests/coroutine/prodcons.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
+++ tests/coroutine/prodcons.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
@@ -0,0 +1,94 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2017 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// prodcons.c --
+//
+// Author           : Peter A. Buhr
+// Created On       : Mon Sep 18 12:23:39 2017
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Wed Dec 12 23:04:49 2018
+// Update Count     : 53
+//
+
+#include <fstream.hfa>
+#include <coroutine.hfa>
+#include <stdlib.hfa>									// random
+#include <unistd.h>										// getpid
+
+coroutine Cons;											// forward
+int delivery( Cons & cons, int p1, int p2 );
+void stop( Cons & cons );
+
+coroutine Prod {
+	Cons & c;
+	int N, money, receipt;
+};
+void main( Prod & prod ) with( prod ) {					// starter ::main
+	// 1st resume starts here
+	for ( i; N ) {										// N pairs of values
+		int p1 = random( 100 ), p2 = random( 100 );
+		sout | p1 | " " | p2;
+		int status = delivery( c, p1, p2 );
+		sout | " $" | money | nl | status;
+		receipt += 1;
+	}
+	stop( c );
+	sout | "prod stops";
+}
+int payment( Prod & prod, int money ) {
+	prod.money = money;
+	resume( prod );										// main 1st time, then
+	return prod.receipt;								// prod in delivery
+}
+void start( Prod & prod, int N, Cons &c ) {
+	&prod.c = &c;
+	prod.[N, receipt] = [N, 0];
+	resume( prod );										// activate main
+}
+
+coroutine Cons {
+	Prod & p;
+	int p1, p2, status;
+	bool done;
+};
+void ?{}( Cons & cons, Prod & p ) {
+	&cons.p = &p;
+	cons.[status, done ] = [0, false];
+}
+void ^?{}( Cons & cons ) {}
+void main( Cons & cons ) with( cons ) {					// starter prod
+	// 1st resume starts here
+	int money = 1, receipt;
+	for ( ; ! done; ) {
+		sout | p1 | " " | p2 | nl | " $" | money;
+		status += 1;
+		receipt = payment( p, money );
+		sout | " #" | receipt;
+		money += 1;
+	}
+	sout | "cons stops";
+}
+int delivery( Cons & cons, int p1, int p2 ) {
+	cons.[p1, p2] = [p1, p2];
+	resume( cons );										// main 1st time, then
+	return cons.status;									// cons in payment
+}
+void stop( Cons & cons ) {
+	cons.done = true;
+	resume( cons );										// activate payment
+}
+int main() {
+	Prod prod;
+	Cons cons = { prod };
+	srandom( /* getpid() */ 103 );						// fixed seed for testing
+	start( prod, 5, cons );
+	sout | "main stops";
+}
+
+// Local Variables: //
+// tab-width: 4 //
+// compile-command: "cfa prodcons.c" //
+// End: //
Index: tests/coroutine/runningTotal.c
===================================================================
--- tests/coroutine/runningTotal.c	(revision d5b2ac82c5d162b3f54cf7db3bdcbb3a48149204)
+++ 	(revision )
@@ -1,51 +1,0 @@
-//
-// Cforall Version 1.0.0 Copyright (C) 2017 University of Waterloo
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-//
-// runningTotal.c --
-//
-// Author           : Peter A. Buhr
-// Created On       : Wed Dec  6 08:05:27 2017
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Tue Dec 11 21:59:00 2018
-// Update Count     : 4
-//
-
-#include <fstream.hfa>
-#include <coroutine.hfa>
-
-coroutine RunTotal {									// input numbers and return running total
-	int input, total;									// communication
-};
-
-void ?{}( RunTotal & rntl ) { rntl.total = 0; }
-
-void update( RunTotal & rntl, int input ) with( rntl ) { // helper
-	total += input;										// remember between activations
-	suspend();											// inactivate on stack
-}
-
-void main( RunTotal & rntl ) with( rntl ) {
-	for () {
-		update( rntl, input );
-	} // for
-}
-
-int add( RunTotal & rntl, int input ) {
-	rntl.input = input;									// pass input to coroutine
-	resume( rntl );
-	return rntl.total;									// return total from coroutine
-}
-int main() {
-	RunTotal rntl;
-	for ( i; 10 ) {
-		sout | i | add( rntl, i );
-	} // for
-}
-
-// Local Variables: //
-// tab-width: 4 //
-// compile-command: "cfa runningTotal.c" //
-// End: //
Index: tests/coroutine/runningTotal.cfa
===================================================================
--- tests/coroutine/runningTotal.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
+++ tests/coroutine/runningTotal.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
@@ -0,0 +1,51 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2017 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// runningTotal.c --
+//
+// Author           : Peter A. Buhr
+// Created On       : Wed Dec  6 08:05:27 2017
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Tue Dec 11 21:59:00 2018
+// Update Count     : 4
+//
+
+#include <fstream.hfa>
+#include <coroutine.hfa>
+
+coroutine RunTotal {									// input numbers and return running total
+	int input, total;									// communication
+};
+
+void ?{}( RunTotal & rntl ) { rntl.total = 0; }
+
+void update( RunTotal & rntl, int input ) with( rntl ) { // helper
+	total += input;										// remember between activations
+	suspend();											// inactivate on stack
+}
+
+void main( RunTotal & rntl ) with( rntl ) {
+	for () {
+		update( rntl, input );
+	} // for
+}
+
+int add( RunTotal & rntl, int input ) {
+	rntl.input = input;									// pass input to coroutine
+	resume( rntl );
+	return rntl.total;									// return total from coroutine
+}
+int main() {
+	RunTotal rntl;
+	for ( i; 10 ) {
+		sout | i | add( rntl, i );
+	} // for
+}
+
+// Local Variables: //
+// tab-width: 4 //
+// compile-command: "cfa runningTotal.c" //
+// End: //
Index: tests/preempt_longrun/Makefile.am
===================================================================
--- tests/preempt_longrun/Makefile.am	(revision d5b2ac82c5d162b3f54cf7db3bdcbb3a48149204)
+++ tests/preempt_longrun/Makefile.am	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
@@ -16,4 +16,5 @@
 
 AUTOMAKE_OPTIONS = foreign    # do not require all the GNU file names
+ACLOCAL_AMFLAGS  = -I automake
 
 repeats=10
Index: tests/preempt_longrun/Makefile.in
===================================================================
--- tests/preempt_longrun/Makefile.in	(revision d5b2ac82c5d162b3f54cf7db3bdcbb3a48149204)
+++ tests/preempt_longrun/Makefile.in	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
@@ -93,6 +93,10 @@
 subdir = tests/preempt_longrun
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/automake/cfa.m4 \
-	$(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/automake/libtool.m4 \
+	$(top_srcdir)/automake/ltoptions.m4 \
+	$(top_srcdir)/automake/ltsugar.m4 \
+	$(top_srcdir)/automake/ltversion.m4 \
+	$(top_srcdir)/automake/lt~obsolete.m4 \
+	$(top_srcdir)/automake/cfa.m4 $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
@@ -333,4 +337,5 @@
 AMTAR = @AMTAR@
 AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AR = @AR@
 AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
@@ -356,4 +361,5 @@
 CPPFLAGS = @CPPFLAGS@
 CXX = @CXX@
+CXXCPP = @CXXCPP@
 CXXDEPMODE = @CXXDEPMODE@
 CXXFLAGS = @CXXFLAGS@
@@ -361,5 +367,8 @@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
 DRIVER_DIR = @DRIVER_DIR@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
@@ -367,4 +376,5 @@
 EGREP = @EGREP@
 EXEEXT = @EXEEXT@
+FGREP = @FGREP@
 GREP = @GREP@
 HOST_FLAGS = @HOST_FLAGS@
@@ -374,4 +384,5 @@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
 LDFLAGS = @LDFLAGS@
 LEX = @LEX@
@@ -382,8 +393,18 @@
 LIBOBJS = @LIBOBJS@
 LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
+LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
 MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
 MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
 OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -395,4 +416,5 @@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 RANLIB = @RANLIB@
+SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
@@ -406,6 +428,8 @@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
 am__include = @am__include@
 am__leading_dot = @am__leading_dot@
@@ -455,4 +479,5 @@
 top_srcdir = @top_srcdir@
 AUTOMAKE_OPTIONS = foreign    # do not require all the GNU file names
+ACLOCAL_AMFLAGS = -I automake
 repeats = 10
 max_time = 600
@@ -502,4 +527,10 @@
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(am__aclocal_m4_deps):
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
 tags TAGS:
 
@@ -805,5 +836,5 @@
 clean: clean-am
 
-clean-am: clean-generic clean-local mostlyclean-am
+clean-am: clean-generic clean-libtool clean-local mostlyclean-am
 
 distclean: distclean-am
@@ -857,5 +888,5 @@
 mostlyclean: mostlyclean-am
 
-mostlyclean-am: mostlyclean-generic
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
 
 pdf: pdf-am
@@ -872,13 +903,14 @@
 
 .PHONY: all all-am all-local check check-TESTS check-am clean \
-	clean-generic clean-local cscopelist-am ctags-am distclean \
-	distclean-generic distdir dvi dvi-am html html-am info info-am \
-	install install-am install-data install-data-am install-dvi \
-	install-dvi-am install-exec install-exec-am install-html \
-	install-html-am install-info install-info-am install-man \
-	install-pdf install-pdf-am install-ps install-ps-am \
-	install-strip installcheck installcheck-am installdirs \
-	maintainer-clean maintainer-clean-generic mostlyclean \
-	mostlyclean-generic pdf pdf-am ps ps-am recheck tags-am \
+	clean-generic clean-libtool clean-local cscopelist-am ctags-am \
+	distclean distclean-generic distclean-libtool distdir dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-data install-data-am install-dvi install-dvi-am \
+	install-exec install-exec-am install-html install-html-am \
+	install-info install-info-am install-man install-pdf \
+	install-pdf-am install-ps install-ps-am install-strip \
+	installcheck installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-generic \
+	mostlyclean-libtool pdf pdf-am ps ps-am recheck tags-am \
 	uninstall uninstall-am
 
Index: tests/pybin/tools.py
===================================================================
--- tests/pybin/tools.py	(revision d5b2ac82c5d162b3f54cf7db3bdcbb3a48149204)
+++ tests/pybin/tools.py	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
@@ -247,7 +247,6 @@
 	if column:
 		cmd = "%s 2> /dev/null" % column
-		print(cmd)
 		proc = Popen(cmd, stdin=PIPE, stderr=None, shell=True)
-		proc.communicate(input=text)
+		proc.communicate(input=text + "\n")
 	else:
 		print(text)
Index: tests/raii/.expect/ctor-autogen-ERR1.txt
===================================================================
--- tests/raii/.expect/ctor-autogen-ERR1.txt	(revision d5b2ac82c5d162b3f54cf7db3bdcbb3a48149204)
+++ tests/raii/.expect/ctor-autogen-ERR1.txt	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
@@ -1,16 +1,16 @@
-raii/ctor-autogen.c:102:1 error: Unique best alternative includes deleted identifier in Cast of:
+raii/ctor-autogen.cfa:102:1 error: Unique best alternative includes deleted identifier in Cast of:
   Application of
     Deleted Expression
       Variable Expression: ?{}: static inline function
       ... with parameters
-        _dst: reference to instance of struct Managed with body 1 
+        _dst: reference to instance of struct Managed with body 1
         x: signed int
-      ... returning nothing 
+      ... returning nothing
 
       ... deleted by: ?{}: function
       ... with parameters
-        m: reference to instance of struct Managed with body 1 
-      ... returning nothing 
-      ... with body 
+        m: reference to instance of struct Managed with body 1
+      ... returning nothing
+      ... with body
         CompoundStmt
           Expression Statement:
@@ -20,7 +20,7 @@
                 intrinsic reference to signed int
                 intrinsic signed int
-              ... returning 
+              ... returning
                 _retval__operator_assign: signed int
-                ... with attributes: 
+                ... with attributes:
                   Attribute with name: unused
 
@@ -28,11 +28,11 @@
             ... to arguments
               Cast of:
-                Member Expression, with field: 
+                Member Expression, with field:
                   x: signed int
-                ... from aggregate: 
+                ... from aggregate:
                   Cast of:
-                    Variable Expression: m: reference to instance of struct Managed with body 1 
+                    Variable Expression: m: reference to instance of struct Managed with body 1
                   ... to:
-                    instance of struct Managed with body 1 
+                    instance of struct Managed with body 1
               ... to:
                 reference to signed int
@@ -49,7 +49,7 @@
   ... to arguments
     Cast of:
-      Variable Expression: x: instance of struct Managed with body 1 
+      Variable Expression: x: instance of struct Managed with body 1
     ... to:
-      reference to instance of struct Managed with body 1 
+      reference to instance of struct Managed with body 1
     constant expression (123 123: signed int)
 
Index: tests/raii/.expect/dtor-early-exit-ERR1.txt
===================================================================
--- tests/raii/.expect/dtor-early-exit-ERR1.txt	(revision d5b2ac82c5d162b3f54cf7db3bdcbb3a48149204)
+++ tests/raii/.expect/dtor-early-exit-ERR1.txt	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
@@ -1,3 +1,3 @@
-raii/dtor-early-exit.c:150:1 error: jump to label 'L1' crosses initialization of y Branch (Goto)
+raii/dtor-early-exit.cfa:150:1 error: jump to label 'L1' crosses initialization of y Branch (Goto)
   with target: L1
   with original target: L1
Index: tests/raii/.expect/dtor-early-exit-ERR2.txt
===================================================================
--- tests/raii/.expect/dtor-early-exit-ERR2.txt	(revision d5b2ac82c5d162b3f54cf7db3bdcbb3a48149204)
+++ tests/raii/.expect/dtor-early-exit-ERR2.txt	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
@@ -1,3 +1,3 @@
-raii/dtor-early-exit.c:214:1 error: jump to label 'L2' crosses initialization of y Branch (Goto)
+raii/dtor-early-exit.cfa:214:1 error: jump to label 'L2' crosses initialization of y Branch (Goto)
   with target: L2
   with original target: L2
Index: tests/raii/.expect/memberCtors-ERR1.txt
===================================================================
--- tests/raii/.expect/memberCtors-ERR1.txt	(revision d5b2ac82c5d162b3f54cf7db3bdcbb3a48149204)
+++ tests/raii/.expect/memberCtors-ERR1.txt	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
@@ -1,1 +1,1 @@
-raii/memberCtors.c:71:1 error: in void ?{}(B &b), field a2 used before being constructed
+raii/memberCtors.cfa:71:1 error: in void ?{}(B &b), field a2 used before being constructed
Index: tests/raii/ctor-autogen.c
===================================================================
--- tests/raii/ctor-autogen.c	(revision d5b2ac82c5d162b3f54cf7db3bdcbb3a48149204)
+++ 	(revision )
@@ -1,153 +1,0 @@
-// TODO: add error cases (e.g., use of field constructors for managed types, etc.)
-
-enum Color { R, G, B };
-
-// empty struct/union should have generated ctor/dtors
-union U {};
-struct S {};
-
-struct SimpleUnion {
-	int x;
-	double y;
-	char z;
-};
-
-struct SimpleStruct {
-	int x;
-	double y;
-	char z;
-};
-
-// struct/union with members with generated ctor/dtors should themselves have generated ctor/dtors
-union PopulatedUnion {
-	Color c;
-	U u;
-	S s;
-};
-
-struct PopulatedStruct {
-	Color c;
-	U u;
-	S s;
-};
-
-// dtype-static generic type is otype
-forall(dtype T)
-struct DtypeStaticStruct {
-  T * data;
-  short size;
-};
-
-forall(dtype T)
-union DtypeStaticUnion {
-  T * data;
-  short size;
-};
-
-// dynamic generic type is otype
-forall(otype T)
-struct DynamicStruct {
-	T x;
-};
-
-forall(otype T)
-union DynamicUnion {
-	T x;
-};
-
-// struct/union that contains a generic type is
-struct GenericContainingStruct {
-	DynamicStruct(int) dsi;
-	DynamicStruct(double) dsd;
-	DynamicUnion(int) dui;
-	DynamicUnion(double) dud;
-	DtypeStaticStruct(int) dssi;
-	DtypeStaticStruct(float) dssf;
-	DtypeStaticUnion(int) dsui;
-	DtypeStaticUnion(float) dsuf;
-};
-
-union GenericContainingUnion {
-	DynamicStruct(int) dsi;
-	DynamicStruct(double) dsd;
-	DynamicUnion(int) dui;
-	DynamicUnion(double) dud;
-	DtypeStaticStruct(int) dssi;
-	DtypeStaticStruct(float) dssf;
-	DtypeStaticUnion(int) dsui;
-	DtypeStaticUnion(float) dsuf;
-};
-
-
-forall(otype T)
-T identity(T x) { return x; }
-
-// can identity e if only sized or only the assertion, but the combination breaks...
-// forall(dtype T | sized(T) | { void ?{}(T &); })
-// void identity(T x) {  }
-
-#if ERR1
-// managed type - defines a constructor - can't use field constructors
-struct Managed {
-	int x;
-};
-
-void ?{}(Managed & m) { m.x = 0; }
-
-// managed type since it contains a managed type - can't use field constructors
-struct InheritManaged {
-	Managed m;
-};
-
-Managed x = { 123 }; // error
-Managed y;           // okay
-
-InheritManaged z = { y };  // error?
-#endif
-
-int main() {
-	S s;
-	U u;
-	Color e;
-
-	// identity(R);  Color constant should be Color which is otype
-	identity(e);  // Color should be an otype
-	identity(u);  // U should be an otype
-	identity(s);  // S should be an otype
-
-	SimpleStruct ss;
-	SimpleUnion su;
-
-	identity(ss);
-	identity(su);
-
-	PopulatedStruct ps;
-	PopulatedUnion pu;
-
-	identity(ps); // should recursively be an otype
-	identity(pu); // should recursively be an otype
-
-	DynamicStruct(int) dsi;
-	DynamicStruct(double) dsd;
-	DynamicUnion(int) dui;
-	DynamicUnion(double) dud;
-	DtypeStaticStruct(int) dssi;
-	DtypeStaticStruct(float) dssf;
-	DtypeStaticUnion(int) dsui;
-	DtypeStaticUnion(float) dsuf;
-
-	identity(dsi);
-	identity(dsd);
-	// identity(dui); // xxx - codegen errors in generated thunk _temp3 (Box-pass-generated assignment return-temporary)
-	// identity(dud);
-	identity(dssi);
-	identity(dssf);
-	identity(dsui);
-	identity(dsuf);
-
-	GenericContainingStruct gcs;
-	GenericContainingUnion gcu;
-
-	identity(gcs);
-	identity(gcu);
-}
Index: tests/raii/ctor-autogen.cfa
===================================================================
--- tests/raii/ctor-autogen.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
+++ tests/raii/ctor-autogen.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
@@ -0,0 +1,153 @@
+// TODO: add error cases (e.g., use of field constructors for managed types, etc.)
+
+enum Color { R, G, B };
+
+// empty struct/union should have generated ctor/dtors
+union U {};
+struct S {};
+
+struct SimpleUnion {
+	int x;
+	double y;
+	char z;
+};
+
+struct SimpleStruct {
+	int x;
+	double y;
+	char z;
+};
+
+// struct/union with members with generated ctor/dtors should themselves have generated ctor/dtors
+union PopulatedUnion {
+	Color c;
+	U u;
+	S s;
+};
+
+struct PopulatedStruct {
+	Color c;
+	U u;
+	S s;
+};
+
+// dtype-static generic type is otype
+forall(dtype T)
+struct DtypeStaticStruct {
+  T * data;
+  short size;
+};
+
+forall(dtype T)
+union DtypeStaticUnion {
+  T * data;
+  short size;
+};
+
+// dynamic generic type is otype
+forall(otype T)
+struct DynamicStruct {
+	T x;
+};
+
+forall(otype T)
+union DynamicUnion {
+	T x;
+};
+
+// struct/union that contains a generic type is
+struct GenericContainingStruct {
+	DynamicStruct(int) dsi;
+	DynamicStruct(double) dsd;
+	DynamicUnion(int) dui;
+	DynamicUnion(double) dud;
+	DtypeStaticStruct(int) dssi;
+	DtypeStaticStruct(float) dssf;
+	DtypeStaticUnion(int) dsui;
+	DtypeStaticUnion(float) dsuf;
+};
+
+union GenericContainingUnion {
+	DynamicStruct(int) dsi;
+	DynamicStruct(double) dsd;
+	DynamicUnion(int) dui;
+	DynamicUnion(double) dud;
+	DtypeStaticStruct(int) dssi;
+	DtypeStaticStruct(float) dssf;
+	DtypeStaticUnion(int) dsui;
+	DtypeStaticUnion(float) dsuf;
+};
+
+
+forall(otype T)
+T identity(T x) { return x; }
+
+// can identity e if only sized or only the assertion, but the combination breaks...
+// forall(dtype T | sized(T) | { void ?{}(T &); })
+// void identity(T x) {  }
+
+#if ERR1
+// managed type - defines a constructor - can't use field constructors
+struct Managed {
+	int x;
+};
+
+void ?{}(Managed & m) { m.x = 0; }
+
+// managed type since it contains a managed type - can't use field constructors
+struct InheritManaged {
+	Managed m;
+};
+
+Managed x = { 123 }; // error
+Managed y;           // okay
+
+InheritManaged z = { y };  // error?
+#endif
+
+int main() {
+	S s;
+	U u;
+	Color e;
+
+	// identity(R);  Color constant should be Color which is otype
+	identity(e);  // Color should be an otype
+	identity(u);  // U should be an otype
+	identity(s);  // S should be an otype
+
+	SimpleStruct ss;
+	SimpleUnion su;
+
+	identity(ss);
+	identity(su);
+
+	PopulatedStruct ps;
+	PopulatedUnion pu;
+
+	identity(ps); // should recursively be an otype
+	identity(pu); // should recursively be an otype
+
+	DynamicStruct(int) dsi;
+	DynamicStruct(double) dsd;
+	DynamicUnion(int) dui;
+	DynamicUnion(double) dud;
+	DtypeStaticStruct(int) dssi;
+	DtypeStaticStruct(float) dssf;
+	DtypeStaticUnion(int) dsui;
+	DtypeStaticUnion(float) dsuf;
+
+	identity(dsi);
+	identity(dsd);
+	// identity(dui); // xxx - codegen errors in generated thunk _temp3 (Box-pass-generated assignment return-temporary)
+	// identity(dud);
+	identity(dssi);
+	identity(dssf);
+	identity(dsui);
+	identity(dsuf);
+
+	GenericContainingStruct gcs;
+	GenericContainingUnion gcu;
+
+	identity(gcs);
+	identity(gcu);
+}
Index: tests/raii/dtor-early-exit.c
===================================================================
--- tests/raii/dtor-early-exit.c	(revision d5b2ac82c5d162b3f54cf7db3bdcbb3a48149204)
+++ 	(revision )
@@ -1,253 +1,0 @@
-//
-// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-//
-// dtor-early-exit.c --
-//
-// Author           : Rob Schluntz
-// Created On       : Wed Aug 17 08:26:25 2016
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Fri Dec 21 08:45:19 2018
-// Update Count     : 10
-//
-
-#include <fstream.hfa>
-#include <stdlib.hfa>
-#include <assert.h>
-
-struct A {
-	const char * name;
-	int * x;
-};
-
-// don't want these called
-void ?{}(A & a) { assert( false ); }
-void ?{}(A & a, const char * name) { a.name = name; sout | "construct " | name; a.x = (int*)malloc(); }
-void ?{}(A & a, const char * name, int * ptr) { assert( false ); }
-
-A ?=?(A & a, A b) {  sout | "assign " | a.name | " " | b.name; return a; }
-void ?{}(A & a, A b) { sout | "copy construct " | b.name; a.x = (int*)malloc(); }
-void ^?{}(A & a) { sout | "destruct " | a.name; free(a.x); }
-
-// test returns
-void f(int i) {
-	sout | "f i=" | i;
-	A x = { "x" };  // construct x
-	{
-		A y = { "y" }; // construct y
-		{
-			A z = { "z" }; // construct z
-			{
-				if (i == 0) return; // destruct x, y, z
-			}
-			if (i == 1) return; // destruct x, y, z
-			// destruct z
-		}
-		if (i == 2) return; // destruct x, y
-		// destruct y
-	}
-	return; // destruct x
-}
-
-// test loops, switch, etc.
-void g() {
-	for (int i = 0; i < 10; i++) {
-		sout | "g for i=" | i;
-		A x = { "x" };
-		// construct x
-		// destruct x
-	}
-	sout | nl;
-	{
-		int i = 0;
-		while (i < 10) {
-			sout | "g while i=" | i;
-			A x = { "x" };
-			// construct x
-			i++;
-			// destruct x
-		}
-	}
-	sout | nl;
-	for (int i = 0; i < 10; i++) {
-		switch(10) {
-			case 0:
-			case 5:
-			case 10: {
-				A y = { "y" };
-				sout | "g switch i=" | i;
-				// construct y
-				break; // destruct y
-			}
-			default: {
-				sout | "g switch i=" | i;
-				A x = { "x" };
-				// construct x
-				break; // destruct x
-			}
-		}
-	}
-	sout | nl;
-	for (int k = 0; k < 2; k++) {
-		sout | "g for k=" | k;
-		L1: for (int i = 0; i < 10; i++) {
-			sout | "g for i=" | i;
-
-			A x = { "x" };
-			if (i == 2) {
-				sout | "continue L1";
-				continue;  // destruct x
-			} else if (i == 3) {
-				sout | "break L1";
-				break;  // destruct x
-			}
-
-			L2: for (int j = 0; j < 10; j++) {
-				sout | "g for j=" | j;
-				A y = { "y" };
-				if (j == 0) {
-					sout | "continue L2";
-					continue; // destruct y - missing because object that needs to be destructed is not a part of this block, it's a part of the for's block
-				} else if (j == 1) {
-					sout | "break L2";
-					break;  // destruct y
-				} else if (i == 1) {
-					sout | "continue L1";
-					continue L1; // destruct x,y - note: continue takes you to destructors for block, so only generate destructor for y
-				} else if (k == 1) {
-					sout | "break L1";
-					break L1;  // destruct x,y
-				}
-			}
-		}
-	}
-
-	sout | nl;
-	L3: if( 3 ) {
-		A w = { "w" };
-		if( 4 ) {
-			A v = { "v" };
-			sout | "break L3";
-			break L3;
-		}
-	}
-}
-
-// test goto
-void h() {
-	int i = 0;
-	// for each goto G with target label L:
-	// * find all constructed variables alive at G (set S_G)
-	// * find all constructed variables alive at L (set S_L)
-	// * if S_L-S_G is non-empty, error
-	// * emit destructors for all variables in S_G-S_L
-	sout | "h";
-	{
-		L0: ;
-#ifdef ERR1
-			goto L1; // this is an error in g++ because it skips initialization of y
-#endif
-			A y = { "y" };
-			// S_L1 = { y }
-		L1: sout | "L1";
-			A x = { "x" };
-			// S_L2 = { y, x }
-		L2: sout | "L2";
-			if (i == 0) {
-				++i;
-				sout | "goto L1";
-				// S_G = { y, x }
-				goto L1;  // jump back, destruct b/c before x definition
-				// S_L-S_G = {} => no error
-				// S_G-S_L = { x } => destruct x
-			} else if (i == 1) {
-				++i;
-				sout | "goto L2";
-				// S_G = { y, x }
-				goto L2;  // jump back, do not destruct
-				// S_L-S_G = {}
-				// S_G-S_L = {} => destruct nothing
-			} else if (i == 2) {
-				++i;
-				sout | "goto L3";
-				// S_G = { y, x }
-				goto L3;  // jump ahead, do not destruct
-				// S_L-S_G = {}
-				// S_G-S_L = {}
-			} else if (false) {
-				++i;
-				A z = { "z" };
-				sout | "goto L3-2";
-				// S_G = { z, y, x }
-				goto L3;
-				// S_L-S_G = {}
-				// S_G-S_L = {z} => destruct z
-			} else {
-				++i;
-				sout | "goto L4";
-				// S_G = { y, x }
-				goto L4;  // jump ahead, destruct b/c left block x was defined in
-				// S_L-S_G = {}
-				// S_G-S_L = { y, x } => destruct y, x
-			}
-			// S_L3 = { y, x }
-		L3: sout | "L3";
-			sout | "goto L2-2";
-			// S_G = { y, x }
-			goto L2; // jump back, do not destruct
-			// S_L-S_G = {}
-			// S_G-S_L = {}
-	}
-	// S_L4 = {}
-	L4: sout | "L4";
-	if (i == 4) {
-		sout | "goto L0";
-		// S_G = {}
-		goto L0;
-		// S_L-S_G = {}
-		// S_G-S_L = {}
-	}
-#ifdef ERR2
-	// S_G = {}
-	if (i == 5) goto L2; // this is an error in g++ because it skips initialization of y, x
-	// S_L-S_G = { y, x } => non-empty, so error
-#endif
-}
-
-// TODO: implement __label__ and uncomment these lines
-void computedGoto() {
-  // __label__ bar;
-  void *ptr;
-  ptr = &&foo;
-  goto *ptr;
-  assert(false);
-foo: ;
-//   void f() {
-//     ptr = &&bar;
-//     goto *ptr;
-//     assert(false);
-//   }
-//   f();
-//   assert(false);
-// bar: ;
-}
-
-int main() {
-	sepDisable(sout);
-	for (int i = 0; i < 4; i++) {
-		f(i);
-	}
-	sout | nl;
-	g();
-	sout | nl;
-	h();
-
-	computedGoto();
-}
-
-// Local Variables: //
-// tab-width: 4 //
-// compile-command: "cfa dtor-early-exit" //
-// End: //
Index: tests/raii/dtor-early-exit.cfa
===================================================================
--- tests/raii/dtor-early-exit.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
+++ tests/raii/dtor-early-exit.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
@@ -0,0 +1,253 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// dtor-early-exit.c --
+//
+// Author           : Rob Schluntz
+// Created On       : Wed Aug 17 08:26:25 2016
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Fri Dec 21 08:45:19 2018
+// Update Count     : 10
+//
+
+#include <fstream.hfa>
+#include <stdlib.hfa>
+#include <assert.h>
+
+struct A {
+	const char * name;
+	int * x;
+};
+
+// don't want these called
+void ?{}(A & a) { assert( false ); }
+void ?{}(A & a, const char * name) { a.name = name; sout | "construct " | name; a.x = (int*)malloc(); }
+void ?{}(A & a, const char * name, int * ptr) { assert( false ); }
+
+A ?=?(A & a, A b) {  sout | "assign " | a.name | " " | b.name; return a; }
+void ?{}(A & a, A b) { sout | "copy construct " | b.name; a.x = (int*)malloc(); }
+void ^?{}(A & a) { sout | "destruct " | a.name; free(a.x); }
+
+// test returns
+void f(int i) {
+	sout | "f i=" | i;
+	A x = { "x" };  // construct x
+	{
+		A y = { "y" }; // construct y
+		{
+			A z = { "z" }; // construct z
+			{
+				if (i == 0) return; // destruct x, y, z
+			}
+			if (i == 1) return; // destruct x, y, z
+			// destruct z
+		}
+		if (i == 2) return; // destruct x, y
+		// destruct y
+	}
+	return; // destruct x
+}
+
+// test loops, switch, etc.
+void g() {
+	for (int i = 0; i < 10; i++) {
+		sout | "g for i=" | i;
+		A x = { "x" };
+		// construct x
+		// destruct x
+	}
+	sout | nl;
+	{
+		int i = 0;
+		while (i < 10) {
+			sout | "g while i=" | i;
+			A x = { "x" };
+			// construct x
+			i++;
+			// destruct x
+		}
+	}
+	sout | nl;
+	for (int i = 0; i < 10; i++) {
+		switch(10) {
+			case 0:
+			case 5:
+			case 10: {
+				A y = { "y" };
+				sout | "g switch i=" | i;
+				// construct y
+				break; // destruct y
+			}
+			default: {
+				sout | "g switch i=" | i;
+				A x = { "x" };
+				// construct x
+				break; // destruct x
+			}
+		}
+	}
+	sout | nl;
+	for (int k = 0; k < 2; k++) {
+		sout | "g for k=" | k;
+		L1: for (int i = 0; i < 10; i++) {
+			sout | "g for i=" | i;
+
+			A x = { "x" };
+			if (i == 2) {
+				sout | "continue L1";
+				continue;  // destruct x
+			} else if (i == 3) {
+				sout | "break L1";
+				break;  // destruct x
+			}
+
+			L2: for (int j = 0; j < 10; j++) {
+				sout | "g for j=" | j;
+				A y = { "y" };
+				if (j == 0) {
+					sout | "continue L2";
+					continue; // destruct y - missing because object that needs to be destructed is not a part of this block, it's a part of the for's block
+				} else if (j == 1) {
+					sout | "break L2";
+					break;  // destruct y
+				} else if (i == 1) {
+					sout | "continue L1";
+					continue L1; // destruct x,y - note: continue takes you to destructors for block, so only generate destructor for y
+				} else if (k == 1) {
+					sout | "break L1";
+					break L1;  // destruct x,y
+				}
+			}
+		}
+	}
+
+	sout | nl;
+	L3: if( 3 ) {
+		A w = { "w" };
+		if( 4 ) {
+			A v = { "v" };
+			sout | "break L3";
+			break L3;
+		}
+	}
+}
+
+// test goto
+void h() {
+	int i = 0;
+	// for each goto G with target label L:
+	// * find all constructed variables alive at G (set S_G)
+	// * find all constructed variables alive at L (set S_L)
+	// * if S_L-S_G is non-empty, error
+	// * emit destructors for all variables in S_G-S_L
+	sout | "h";
+	{
+		L0: ;
+#ifdef ERR1
+			goto L1; // this is an error in g++ because it skips initialization of y
+#endif
+			A y = { "y" };
+			// S_L1 = { y }
+		L1: sout | "L1";
+			A x = { "x" };
+			// S_L2 = { y, x }
+		L2: sout | "L2";
+			if (i == 0) {
+				++i;
+				sout | "goto L1";
+				// S_G = { y, x }
+				goto L1;  // jump back, destruct b/c before x definition
+				// S_L-S_G = {} => no error
+				// S_G-S_L = { x } => destruct x
+			} else if (i == 1) {
+				++i;
+				sout | "goto L2";
+				// S_G = { y, x }
+				goto L2;  // jump back, do not destruct
+				// S_L-S_G = {}
+				// S_G-S_L = {} => destruct nothing
+			} else if (i == 2) {
+				++i;
+				sout | "goto L3";
+				// S_G = { y, x }
+				goto L3;  // jump ahead, do not destruct
+				// S_L-S_G = {}
+				// S_G-S_L = {}
+			} else if (false) {
+				++i;
+				A z = { "z" };
+				sout | "goto L3-2";
+				// S_G = { z, y, x }
+				goto L3;
+				// S_L-S_G = {}
+				// S_G-S_L = {z} => destruct z
+			} else {
+				++i;
+				sout | "goto L4";
+				// S_G = { y, x }
+				goto L4;  // jump ahead, destruct b/c left block x was defined in
+				// S_L-S_G = {}
+				// S_G-S_L = { y, x } => destruct y, x
+			}
+			// S_L3 = { y, x }
+		L3: sout | "L3";
+			sout | "goto L2-2";
+			// S_G = { y, x }
+			goto L2; // jump back, do not destruct
+			// S_L-S_G = {}
+			// S_G-S_L = {}
+	}
+	// S_L4 = {}
+	L4: sout | "L4";
+	if (i == 4) {
+		sout | "goto L0";
+		// S_G = {}
+		goto L0;
+		// S_L-S_G = {}
+		// S_G-S_L = {}
+	}
+#ifdef ERR2
+	// S_G = {}
+	if (i == 5) goto L2; // this is an error in g++ because it skips initialization of y, x
+	// S_L-S_G = { y, x } => non-empty, so error
+#endif
+}
+
+// TODO: implement __label__ and uncomment these lines
+void computedGoto() {
+  // __label__ bar;
+  void *ptr;
+  ptr = &&foo;
+  goto *ptr;
+  assert(false);
+foo: ;
+//   void f() {
+//     ptr = &&bar;
+//     goto *ptr;
+//     assert(false);
+//   }
+//   f();
+//   assert(false);
+// bar: ;
+}
+
+int main() {
+	sepDisable(sout);
+	for (int i = 0; i < 4; i++) {
+		f(i);
+	}
+	sout | nl;
+	g();
+	sout | nl;
+	h();
+
+	computedGoto();
+}
+
+// Local Variables: //
+// tab-width: 4 //
+// compile-command: "cfa dtor-early-exit" //
+// End: //
Index: tests/raii/globals.c
===================================================================
--- tests/raii/globals.c	(revision d5b2ac82c5d162b3f54cf7db3bdcbb3a48149204)
+++ 	(revision )
@@ -1,83 +1,0 @@
-#include <fstream.hfa>
-
-struct value_t {
-	int value;
-};
-
-void ?{}( value_t & this ) { this.value = 22; }
-
-//Standard case
-struct g_t {
-	value_t val;
-};
-
-void ?{}( g_t & this ) { (this.val){}; }
-
-g_t g;
-
-//Autogen case
-struct ga_t {
-	value_t val;
-};
-
-ga_t ga;
-
-//Inline case
-struct gi_t;
-void ?{}( gi_t & this );
-
-struct gi_t {
-	value_t val;
-} gi;
-
-void ?{}( gi_t & this ) { (this.val){}; }
-
-//Inline autogen case
-struct gia_t {
-	value_t val;
-} gia;
-
-//Static case
-struct gs_t {
-	value_t val;
-};
-
-void ?{}( gs_t & this ) { (this.val){}; }
-
-static gs_t gs;
-
-//Static autogen case
-struct gsa_t {
-	value_t val;
-};
-
-static gsa_t gsa;
-
-//Static inline case
-struct gsi_t;
-void ?{}( gsi_t & this );
-
-static struct gsi_t {
-	value_t val;
-} gsi;
-
-void ?{}( gsi_t & this ) { (this.val){}; }
-
-//Static inline autogen case
-static struct gsia_t {
-	value_t val;
-} gsia;
-
-int main() {
-	sout | "static\t\tinline\t\tautogen\t\tvalue";
-
-	sout | "no \t\tno \t\tno \t\t" | g.val.value;
-	sout | "no \t\tno \t\tyes\t\t" | ga.val.value;
-	sout | "no \t\tyes\t\tno \t\t" | gi.val.value;
-	sout | "no \t\tyes\t\tyes\t\t" | gia.val.value;
-	sout | "yes\t\tno \t\tno \t\t" | gs.val.value;
-	sout | "yes\t\tno \t\tyes\t\t" | gsa.val.value;
-	sout | "yes\t\tyes\t\tno \t\t" | gsi.val.value;
-	sout | "yes\t\tyes\t\tyes\t\t" | gsia.val.value;
-
-}
Index: tests/raii/globals.cfa
===================================================================
--- tests/raii/globals.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
+++ tests/raii/globals.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
@@ -0,0 +1,83 @@
+#include <fstream.hfa>
+
+struct value_t {
+	int value;
+};
+
+void ?{}( value_t & this ) { this.value = 22; }
+
+//Standard case
+struct g_t {
+	value_t val;
+};
+
+void ?{}( g_t & this ) { (this.val){}; }
+
+g_t g;
+
+//Autogen case
+struct ga_t {
+	value_t val;
+};
+
+ga_t ga;
+
+//Inline case
+struct gi_t;
+void ?{}( gi_t & this );
+
+struct gi_t {
+	value_t val;
+} gi;
+
+void ?{}( gi_t & this ) { (this.val){}; }
+
+//Inline autogen case
+struct gia_t {
+	value_t val;
+} gia;
+
+//Static case
+struct gs_t {
+	value_t val;
+};
+
+void ?{}( gs_t & this ) { (this.val){}; }
+
+static gs_t gs;
+
+//Static autogen case
+struct gsa_t {
+	value_t val;
+};
+
+static gsa_t gsa;
+
+//Static inline case
+struct gsi_t;
+void ?{}( gsi_t & this );
+
+static struct gsi_t {
+	value_t val;
+} gsi;
+
+void ?{}( gsi_t & this ) { (this.val){}; }
+
+//Static inline autogen case
+static struct gsia_t {
+	value_t val;
+} gsia;
+
+int main() {
+	sout | "static\t\tinline\t\tautogen\t\tvalue";
+
+	sout | "no \t\tno \t\tno \t\t" | g.val.value;
+	sout | "no \t\tno \t\tyes\t\t" | ga.val.value;
+	sout | "no \t\tyes\t\tno \t\t" | gi.val.value;
+	sout | "no \t\tyes\t\tyes\t\t" | gia.val.value;
+	sout | "yes\t\tno \t\tno \t\t" | gs.val.value;
+	sout | "yes\t\tno \t\tyes\t\t" | gsa.val.value;
+	sout | "yes\t\tyes\t\tno \t\t" | gsi.val.value;
+	sout | "yes\t\tyes\t\tyes\t\t" | gsia.val.value;
+
+}
Index: tests/raii/init_once.c
===================================================================
--- tests/raii/init_once.c	(revision d5b2ac82c5d162b3f54cf7db3bdcbb3a48149204)
+++ 	(revision )
@@ -1,195 +1,0 @@
-//
-// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-//
-// init_once.c --
-//
-// Author           : Rob Schluntz
-// Created On       : Tue Jun 14 15:43:35 2016
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Sat Jul  9 11:30:29 2016
-// Update Count     : 3
-//
-
-// want to ensure ctor/dtor called at most once per object.
-// whole point of ctor/dtor is that you don't know what's in
-// memory when it's first called, so can't rely on member to
-// determine if this is true. instead, keep an array
-// of addresses that have been constructed and remove the element
-// when it's destructed (and vice-versa)
-
-//*** setup
-extern "C" {
-#define NULL 0
-void * malloc(size_t);
-void free(void *);
-#define assert(cond) if (! (cond)) { printf("Assertion failed: (%s) at %s:%d\n", #cond, __FILE__, __LINE__); abort(); }
-void *memset(void *s, int c, size_t n);
-}
-
-// dummy type
-struct init_once { int * x; };
-
-// array and operations
-// const int size = 1024;
-#define size 1024
-struct array {
-	init_once * elems[size];
-	int length;
-};
-void remove(array * arr, init_once * x) {
-	for (int i = 0; i < arr->length; i++) {
-		if ( arr->elems[i] == x ) {
-			arr->elems[i] = arr->elems[--arr->length];
-			return;
-		}
-	}
-}
-void insert(array * arr, init_once * x) {
-	assert( arr->length < size );
-	arr->elems[arr->length++] = x;
-}
-int find(array * arr, init_once * x) {
-	for (int i = 0; i < arr->length; i++) {
-		if ( arr->elems[i] == x ) {
-			return i;
-		}
-	}
-	return -1;
-}
-void ?{}(array & arr) {
-	memset(arr.elems, 0, sizeof(arr.elems));
-	arr.length = 0;
-}
-array constructed;
-array destructed;
-
-void ?{}(init_once & x) {
-	assert( find( &constructed, &x ) == -1 );
-	remove( &destructed, &x );
-	insert( &constructed, &x );
-
-	x.x = (int *)malloc(sizeof(int));
-}
-
-void ?{}(init_once & x, init_once other) {
-	x{};  // reuse default ctor
-}
-
-void ^?{}(init_once & x) {
-	assert( find( &destructed, &x ) == -1 );
-	remove( &constructed, &x );
-	insert( &destructed, &x );
-
-	free(x.x);
-}
-//*** end setup
-
-// test globals
-init_once x;
-init_once y = x;
-
-void static_variable() {
-	static init_once x;
-}
-
-int main() {
-	// local variables
-	init_once x;
-	init_once y = x;
-
-	// block scoped variables
-	{
-		init_once x;
-		init_once y = x;
-	}
-
-	// loop variables
-	for (int i = 0 ; i < 10; i++) {
-		init_once x;
-		init_once y = x;
-	}
-	int i = 0;
-	while (i < 10) {
-		init_once x;
-		init_once y = x;
-		i++;
-	}
-
-	// declared in a switch block with a break
-	for (int i = 0; i < 10; i++) {
-		switch (10) {
-			case 1: {
-				init_once x;
-				init_once y = x;
-				x{}; // ensure this doesn't execute
-				break;
-			}
-			case 10: {
-				init_once x;
-				init_once y = x;
-			} // fall through
-			default: {
-				init_once x;
-				init_once y = x;
-				break;
-			}
-		}
-	}
-
-	// labeled break/continue
-	L3: for (int k = 0; k < 10; k++) {
-		init_once x;
-		init_once y = x;
-		L1: for (int i = 0; i < 10; i++){
-			init_once x;
-			init_once y = x;
-			L2: for (int j = 0; j < 10; j++) {
-				init_once x;
-				init_once y = x;
-
-				if (i == 0) continue L1;
-				if (i == 1) continue L2;
-				if (i == 2) break L2;
-				if (i == 3) break L1;
-				if (i == 4) continue L3;
-				if (i == 9) break L3;
-				// if (i == 5) goto ;
-			}
-		}
-	}
-
-	// labeled break/continue with if
-	LL1: for (int k = 0; k < 10; k++) {
-		init_once x;
-		init_once y = x;
-		LL2: for (int i = 0; i < 10; i++){
-			init_once x;
-			init_once y = x;
-			LL3: if( i < 5) {
-				init_once x;
-				init_once y = x;
-
-				if (i == 0) continue LL2;
-				if (i == 2) break LL3;
-				if (i == 3) break LL2;
-				if (i == 4) continue LL1;
-			} else {
-				if (i == 9) break LL1;
-				// if (i == 5) goto ;
-			}
-		}
-	}
-
-	// function-scoped static variable
-	for (int i = 0; i < 10; i++) {
-		static_variable();
-	}
-}
-
-// Local Variables: //
-// tab-width: 4 //
-// compile-command: "cfa init_once.c" //
-// End: //
Index: tests/raii/init_once.cfa
===================================================================
--- tests/raii/init_once.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
+++ tests/raii/init_once.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
@@ -0,0 +1,195 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// init_once.c --
+//
+// Author           : Rob Schluntz
+// Created On       : Tue Jun 14 15:43:35 2016
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Sat Jul  9 11:30:29 2016
+// Update Count     : 3
+//
+
+// want to ensure ctor/dtor called at most once per object.
+// whole point of ctor/dtor is that you don't know what's in
+// memory when it's first called, so can't rely on member to
+// determine if this is true. instead, keep an array
+// of addresses that have been constructed and remove the element
+// when it's destructed (and vice-versa)
+
+//*** setup
+extern "C" {
+#define NULL 0
+void * malloc(size_t);
+void free(void *);
+#define assert(cond) if (! (cond)) { printf("Assertion failed: (%s) at %s:%d\n", #cond, __FILE__, __LINE__); abort(); }
+void *memset(void *s, int c, size_t n);
+}
+
+// dummy type
+struct init_once { int * x; };
+
+// array and operations
+// const int size = 1024;
+#define size 1024
+struct array {
+	init_once * elems[size];
+	int length;
+};
+void remove(array * arr, init_once * x) {
+	for (int i = 0; i < arr->length; i++) {
+		if ( arr->elems[i] == x ) {
+			arr->elems[i] = arr->elems[--arr->length];
+			return;
+		}
+	}
+}
+void insert(array * arr, init_once * x) {
+	assert( arr->length < size );
+	arr->elems[arr->length++] = x;
+}
+int find(array * arr, init_once * x) {
+	for (int i = 0; i < arr->length; i++) {
+		if ( arr->elems[i] == x ) {
+			return i;
+		}
+	}
+	return -1;
+}
+void ?{}(array & arr) {
+	memset(arr.elems, 0, sizeof(arr.elems));
+	arr.length = 0;
+}
+array constructed;
+array destructed;
+
+void ?{}(init_once & x) {
+	assert( find( &constructed, &x ) == -1 );
+	remove( &destructed, &x );
+	insert( &constructed, &x );
+
+	x.x = (int *)malloc(sizeof(int));
+}
+
+void ?{}(init_once & x, init_once other) {
+	x{};  // reuse default ctor
+}
+
+void ^?{}(init_once & x) {
+	assert( find( &destructed, &x ) == -1 );
+	remove( &constructed, &x );
+	insert( &destructed, &x );
+
+	free(x.x);
+}
+//*** end setup
+
+// test globals
+init_once x;
+init_once y = x;
+
+void static_variable() {
+	static init_once x;
+}
+
+int main() {
+	// local variables
+	init_once x;
+	init_once y = x;
+
+	// block scoped variables
+	{
+		init_once x;
+		init_once y = x;
+	}
+
+	// loop variables
+	for (int i = 0 ; i < 10; i++) {
+		init_once x;
+		init_once y = x;
+	}
+	int i = 0;
+	while (i < 10) {
+		init_once x;
+		init_once y = x;
+		i++;
+	}
+
+	// declared in a switch block with a break
+	for (int i = 0; i < 10; i++) {
+		switch (10) {
+			case 1: {
+				init_once x;
+				init_once y = x;
+				x{}; // ensure this doesn't execute
+				break;
+			}
+			case 10: {
+				init_once x;
+				init_once y = x;
+			} // fall through
+			default: {
+				init_once x;
+				init_once y = x;
+				break;
+			}
+		}
+	}
+
+	// labeled break/continue
+	L3: for (int k = 0; k < 10; k++) {
+		init_once x;
+		init_once y = x;
+		L1: for (int i = 0; i < 10; i++){
+			init_once x;
+			init_once y = x;
+			L2: for (int j = 0; j < 10; j++) {
+				init_once x;
+				init_once y = x;
+
+				if (i == 0) continue L1;
+				if (i == 1) continue L2;
+				if (i == 2) break L2;
+				if (i == 3) break L1;
+				if (i == 4) continue L3;
+				if (i == 9) break L3;
+				// if (i == 5) goto ;
+			}
+		}
+	}
+
+	// labeled break/continue with if
+	LL1: for (int k = 0; k < 10; k++) {
+		init_once x;
+		init_once y = x;
+		LL2: for (int i = 0; i < 10; i++){
+			init_once x;
+			init_once y = x;
+			LL3: if( i < 5) {
+				init_once x;
+				init_once y = x;
+
+				if (i == 0) continue LL2;
+				if (i == 2) break LL3;
+				if (i == 3) break LL2;
+				if (i == 4) continue LL1;
+			} else {
+				if (i == 9) break LL1;
+				// if (i == 5) goto ;
+			}
+		}
+	}
+
+	// function-scoped static variable
+	for (int i = 0; i < 10; i++) {
+		static_variable();
+	}
+}
+
+// Local Variables: //
+// tab-width: 4 //
+// compile-command: "cfa init_once.c" //
+// End: //
Index: tests/raii/memberCtors.c
===================================================================
--- tests/raii/memberCtors.c	(revision d5b2ac82c5d162b3f54cf7db3bdcbb3a48149204)
+++ 	(revision )
@@ -1,91 +1,0 @@
-struct WrappedInt {
-  int x;
-};
-
-void ?{}(WrappedInt & this) {
-  printf("constructing int\n");
-  this.x = 0;
-}
-
-void ?{}(WrappedInt & this, WrappedInt other) {
-  printf("copy constructing int: %d\n", other.x);
-  this.x = other.x;
-}
-
-void ?{}(WrappedInt & this, int x) {
-  printf("constructing int: %d\n", x);
-  this.x = x;
-}
-
-void ^?{}(WrappedInt & this) {
-  printf("destructing int: %d\n", this.x);
-}
-
-void ?=?(WrappedInt & this, int x) {
-  printf("assigning int: %d %d\n", this.x, x);
-  this.x = x;
-}
-
-struct A {
-  WrappedInt x, y, z;
-};
-
-void ?{}(A & a) {
-  // currently must define default ctor, since there's no "= default" syntax
-}
-
-void ?{}(A & a, int x) {
-  printf("begin construct A\n");
-  printf("construct a.x\n");
-  (a.x){ x+999 };
-  printf("assign a.y\n");
-  a.y = 0; // not a constructor - default constructor will be inserted
-  printf("end construct A\n");
-} // z never constructed - will be automatically default constructed
-
-void ?{}(A & this, A other) {
-  printf("begin copy construct A\n");
-  printf("copy construct this.x\n");
-  (this.x){ other.x };
-  printf("assign this.y\n");
-  this.y = other.y; // not a constructor - copy constructor will be inserted
-  printf("end copy construct A\n");
-} // z never constructed - will be automatically copy constructed
-
-A ?=?(A & this, A other) {
-  printf("begin ?=? A\n");
-  this.x = other.x;
-  this.y = other.y;
-  this.z = other.z;
-  printf("end ?=? A\n");
-  return this;
-}
-
-struct B {
-  A a1, a2, a3;
-};
-
-void ?{}(B & b) {
-  printf("begin construct B\n");
-  printf("assign b.a2\n");
-  b.a2 = (A) { 2 };
-  printf("construct b.a1\n");
-  (b.a1){ 1 };
-#ifdef ERR1
-  (b.a2){ b.a3 }; // error, b->a2 was used previously but is explicitly constructed
-#endif
-  printf("end construct B\n");
-} // a2, a3 never constructed - will be automatically default constructed
-
-void ^?{}(B & b) {
-  b.a2 = (A) { 0 };
-  ^(b.a1){};
-} // a2, a3 never destructed - will be automatically destructed
-
-int main() {
-  printf("Before declaration of b1\n");
-  B b1;
-  printf("Before declaration of b2\n");
-  B b2 = b1;
-  printf("End of main\n");
-}
Index: tests/raii/memberCtors.cfa
===================================================================
--- tests/raii/memberCtors.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
+++ tests/raii/memberCtors.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
@@ -0,0 +1,91 @@
+struct WrappedInt {
+  int x;
+};
+
+void ?{}(WrappedInt & this) {
+  printf("constructing int\n");
+  this.x = 0;
+}
+
+void ?{}(WrappedInt & this, WrappedInt other) {
+  printf("copy constructing int: %d\n", other.x);
+  this.x = other.x;
+}
+
+void ?{}(WrappedInt & this, int x) {
+  printf("constructing int: %d\n", x);
+  this.x = x;
+}
+
+void ^?{}(WrappedInt & this) {
+  printf("destructing int: %d\n", this.x);
+}
+
+void ?=?(WrappedInt & this, int x) {
+  printf("assigning int: %d %d\n", this.x, x);
+  this.x = x;
+}
+
+struct A {
+  WrappedInt x, y, z;
+};
+
+void ?{}(A & a) {
+  // currently must define default ctor, since there's no "= default" syntax
+}
+
+void ?{}(A & a, int x) {
+  printf("begin construct A\n");
+  printf("construct a.x\n");
+  (a.x){ x+999 };
+  printf("assign a.y\n");
+  a.y = 0; // not a constructor - default constructor will be inserted
+  printf("end construct A\n");
+} // z never constructed - will be automatically default constructed
+
+void ?{}(A & this, A other) {
+  printf("begin copy construct A\n");
+  printf("copy construct this.x\n");
+  (this.x){ other.x };
+  printf("assign this.y\n");
+  this.y = other.y; // not a constructor - copy constructor will be inserted
+  printf("end copy construct A\n");
+} // z never constructed - will be automatically copy constructed
+
+A ?=?(A & this, A other) {
+  printf("begin ?=? A\n");
+  this.x = other.x;
+  this.y = other.y;
+  this.z = other.z;
+  printf("end ?=? A\n");
+  return this;
+}
+
+struct B {
+  A a1, a2, a3;
+};
+
+void ?{}(B & b) {
+  printf("begin construct B\n");
+  printf("assign b.a2\n");
+  b.a2 = (A) { 2 };
+  printf("construct b.a1\n");
+  (b.a1){ 1 };
+#ifdef ERR1
+  (b.a2){ b.a3 }; // error, b->a2 was used previously but is explicitly constructed
+#endif
+  printf("end construct B\n");
+} // a2, a3 never constructed - will be automatically default constructed
+
+void ^?{}(B & b) {
+  b.a2 = (A) { 0 };
+  ^(b.a1){};
+} // a2, a3 never destructed - will be automatically destructed
+
+int main() {
+  printf("Before declaration of b1\n");
+  B b1;
+  printf("Before declaration of b2\n");
+  B b2 = b1;
+  printf("End of main\n");
+}
Index: tests/raii/multiDimension.c
===================================================================
--- tests/raii/multiDimension.c	(revision d5b2ac82c5d162b3f54cf7db3bdcbb3a48149204)
+++ 	(revision )
@@ -1,75 +1,0 @@
-struct X {
-  int a;
-  int * ptr;
-};
-
-void ?{}(X & this) {
-  printf("default constructing\n");
-  (this.a){ 123 };
-  this.ptr = (int *)malloc(sizeof(int));
-}
-
-void ?{}(X & this, X other) {
-  printf("copy constructing\n");
-  (this.a){ other.a };
-  this.ptr = (int *)malloc(sizeof(int));
-}
-
-void ?{}(X & this, int a) {
-  printf("constructing with %d\n", a);
-  (this.a){ a };
-  this.ptr = (int *)malloc(sizeof(int));
-}
-
-void ^?{}(X & this) {
-  printf("destructing\n");
-  free(this.ptr);
-}
-
-X ?=?(X & this, X other) {
-  this.a = other.a;
-  return this;
-}
-
-X global[10][10] = {
-  { 1, { 2 }, { 3 }, { 4 }, 5, 6, 7, 8, 9, 10, 11, 12 },
-  { 1, 2, 3, 4 },
-  { { 1234567 } }
-};
-
-X global2[3][3][3] = {
-  {
-    { 1, 2, 3 },
-    { 4, 5, 6 },
-    { 7, 8, 9 },
-    { 10, 11, 12 }
-  },
-  {
-    { 0, 0, 0 }
-  }
-};
-
-int foo() {
-  static X abc[3][3] = {
-    { 11, 22, 33, 44 },
-    { 55, 66 },
-    { 77 },
-    { 88, 99, 1010 }
-  };
-}
-
-// ensure constructed const arrays continue to compile
-const int global[1] = { -2 };
-
-int main() {
-  X abc[4][4] = {
-    { 999, 1111 },
-    { 1, 2, 3, 4, 5 },
-    {},
-    { 0 },
-    { 88 }
-  };
-
-  foo();
-  foo();
-}
Index: tests/raii/multiDimension.cfa
===================================================================
--- tests/raii/multiDimension.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
+++ tests/raii/multiDimension.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
@@ -0,0 +1,75 @@
+struct X {
+  int a;
+  int * ptr;
+};
+
+void ?{}(X & this) {
+  printf("default constructing\n");
+  (this.a){ 123 };
+  this.ptr = (int *)malloc(sizeof(int));
+}
+
+void ?{}(X & this, X other) {
+  printf("copy constructing\n");
+  (this.a){ other.a };
+  this.ptr = (int *)malloc(sizeof(int));
+}
+
+void ?{}(X & this, int a) {
+  printf("constructing with %d\n", a);
+  (this.a){ a };
+  this.ptr = (int *)malloc(sizeof(int));
+}
+
+void ^?{}(X & this) {
+  printf("destructing\n");
+  free(this.ptr);
+}
+
+X ?=?(X & this, X other) {
+  this.a = other.a;
+  return this;
+}
+
+X global[10][10] = {
+  { 1, { 2 }, { 3 }, { 4 }, 5, 6, 7, 8, 9, 10, 11, 12 },
+  { 1, 2, 3, 4 },
+  { { 1234567 } }
+};
+
+X global2[3][3][3] = {
+  {
+    { 1, 2, 3 },
+    { 4, 5, 6 },
+    { 7, 8, 9 },
+    { 10, 11, 12 }
+  },
+  {
+    { 0, 0, 0 }
+  }
+};
+
+int foo() {
+  static X abc[3][3] = {
+    { 11, 22, 33, 44 },
+    { 55, 66 },
+    { 77 },
+    { 88, 99, 1010 }
+  };
+}
+
+// ensure constructed const arrays continue to compile
+const int global[1] = { -2 };
+
+int main() {
+  X abc[4][4] = {
+    { 999, 1111 },
+    { 1, 2, 3, 4, 5 },
+    {},
+    { 0 },
+    { 88 }
+  };
+
+  foo();
+  foo();
+}
Index: tests/test.py
===================================================================
--- tests/test.py	(revision d5b2ac82c5d162b3f54cf7db3bdcbb3a48149204)
+++ tests/test.py	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
@@ -34,7 +34,4 @@
 # reads the directory ./.expect and indentifies the tests
 def listTests( includes, excludes ):
-	includes = [canonicalPath( i ) for i in includes] if includes else None
-	excludes = [canonicalPath( i ) for i in excludes] if excludes else None
-
 	# tests directly in the .expect folder will always be processed
 	test_list = findTests()
Index: tests/tuple/tupleAssign.c
===================================================================
--- tests/tuple/tupleAssign.c	(revision d5b2ac82c5d162b3f54cf7db3bdcbb3a48149204)
+++ 	(revision )
@@ -1,66 +1,0 @@
-//
-// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-//
-// tupleAssign.c --
-//
-// Author           : Rob Schluntz
-// Created On       : Tue Nov 15 17:24:32 2016
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Tue Dec  4 22:03:48 2018
-// Update Count     : 35
-//
-
-#include <fstream.hfa>
-
-int main() {
-	{
-		// test multiple assignment and cascading assignment
-		int u = 5, v = 6, x = 10, y = 11;
-		[int, int] z = [100, 200];
-
-		// swap x, y and store the new [x, y] in [u, v] and in z;
-		printf( "u=%d v=%d x=%d y=%d z=[%d, %d]\n", u, v, x, y, z );
-		sout | "u=" | u | "v=" | v | "x=" | x | "y=" | y | "z=[" | z | "]";
-		z = [u, v] = [x, y] = [y, x];
-		printf( "u=%d v=%d x=%d y=%d z=[%d, %d]\n", u, v, x, y, z );
-		sout | "u=" | u | "v=" | v | "x=" | x | "y=" | y | "z=[" | z | "]";
-
-		// shuffle elements -- v = z.0, z.0 = z.1, z.1 = u, u = v
-		[v, z, u] = [z, u, v];
-		printf( "u=%d v=%d z=[%d, %d]\n", u, v, z );
-		sout | "u=" | u | "v=" | v | "z=[" | z | "]";
-
-		// multiple assignment with tuple expression on right
-		z = [111, 222];
-		[u, v] = [123, 456];
-		printf( "u=%d v=%d z=[%d, %d]\n", u, v, z );
-		sout | "u=" | u | "v=" | v | "z=[" | z | "]";
-	}
-	{
-		// test mass assignment
-		double d = 0.0;
-		int i = 0;
-		char c = '\0';
-		struct X {
-			int z;
-		} x;
-		X ?=?(X & x, double d) { return x; }
-		[int, double, int] t;
-
-		// no conversion from X to integral types, so this serves as a santiy
-		// check that as long as this compiles, ?=?(_, x) is not generated.
-		[t, x, d, i, c, x] = (double)94.12;
-		printf( "d=%lg i=%d c=%c t=[%d, %lg, %d]\n", d, i, (int)c, t );
-		sout | "d=" | d | "i=" | i | "c=" | c | ' ' | "t=[" | t | "]";
-		[x, c, i, d, x, t] = (double)-94.12;
-		printf( "d=%lg i=%d c=%c t=[%d, %lg, %d]\n", d, i, c, t );
-		sout | "d=" | d | "i=" | i | "c=" | c | ' ' | "t=[" | t | "]";
-	}
-}
-
-// Local Variables: //
-// tab-width: 4 //
-// End: //
Index: tests/tuple/tupleAssign.cfa
===================================================================
--- tests/tuple/tupleAssign.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
+++ tests/tuple/tupleAssign.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
@@ -0,0 +1,66 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// tupleAssign.c --
+//
+// Author           : Rob Schluntz
+// Created On       : Tue Nov 15 17:24:32 2016
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Tue Dec  4 22:03:48 2018
+// Update Count     : 35
+//
+
+#include <fstream.hfa>
+
+int main() {
+	{
+		// test multiple assignment and cascading assignment
+		int u = 5, v = 6, x = 10, y = 11;
+		[int, int] z = [100, 200];
+
+		// swap x, y and store the new [x, y] in [u, v] and in z;
+		printf( "u=%d v=%d x=%d y=%d z=[%d, %d]\n", u, v, x, y, z );
+		sout | "u=" | u | "v=" | v | "x=" | x | "y=" | y | "z=[" | z | "]";
+		z = [u, v] = [x, y] = [y, x];
+		printf( "u=%d v=%d x=%d y=%d z=[%d, %d]\n", u, v, x, y, z );
+		sout | "u=" | u | "v=" | v | "x=" | x | "y=" | y | "z=[" | z | "]";
+
+		// shuffle elements -- v = z.0, z.0 = z.1, z.1 = u, u = v
+		[v, z, u] = [z, u, v];
+		printf( "u=%d v=%d z=[%d, %d]\n", u, v, z );
+		sout | "u=" | u | "v=" | v | "z=[" | z | "]";
+
+		// multiple assignment with tuple expression on right
+		z = [111, 222];
+		[u, v] = [123, 456];
+		printf( "u=%d v=%d z=[%d, %d]\n", u, v, z );
+		sout | "u=" | u | "v=" | v | "z=[" | z | "]";
+	}
+	{
+		// test mass assignment
+		double d = 0.0;
+		int i = 0;
+		char c = '\0';
+		struct X {
+			int z;
+		} x;
+		X ?=?(X & x, double d) { return x; }
+		[int, double, int] t;
+
+		// no conversion from X to integral types, so this serves as a santiy
+		// check that as long as this compiles, ?=?(_, x) is not generated.
+		[t, x, d, i, c, x] = (double)94.12;
+		printf( "d=%lg i=%d c=%c t=[%d, %lg, %d]\n", d, i, (int)c, t );
+		sout | "d=" | d | "i=" | i | "c=" | c | ' ' | "t=[" | t | "]";
+		[x, c, i, d, x, t] = (double)-94.12;
+		printf( "d=%lg i=%d c=%c t=[%d, %lg, %d]\n", d, i, c, t );
+		sout | "d=" | d | "i=" | i | "c=" | c | ' ' | "t=[" | t | "]";
+	}
+}
+
+// Local Variables: //
+// tab-width: 4 //
+// End: //
Index: tests/tuple/tupleCast.c
===================================================================
--- tests/tuple/tupleCast.c	(revision d5b2ac82c5d162b3f54cf7db3bdcbb3a48149204)
+++ 	(revision )
@@ -1,30 +1,0 @@
-//
-// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-//
-// tupleCast.c --
-//
-// Author           : Rob Schluntz
-// Created On       : Mon Dec 12 15:56:07 2016
-// Last Modified By : Rob Schluntz
-// Last Modified On : Mon Dec 12 15:56:20 2016
-// Update Count     : 2
-//
-
-[char, int, double] f() { printf("ran f\n"); return ['c', 70, 6.28]; }
-
-int main() {
-  [int, char, float] x = [10, 'A', 3.14f];
-  printf("%d %c %g\n", ([int, char, float])x);
-  printf("%d %c\n", ([int, char])x);
-  printf("%d\n", ([int])x);
-  // printf("%d\n", (int)x);
-  printf("%g %g\n", ([double, float])x);
-  printf("%d %c\n", ([int, char])f());
-}
-
-// Local Variables: //
-// tab-width: 2 //
-// End: //
Index: tests/tuple/tupleCast.cfa
===================================================================
--- tests/tuple/tupleCast.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
+++ tests/tuple/tupleCast.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
@@ -0,0 +1,30 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// tupleCast.c --
+//
+// Author           : Rob Schluntz
+// Created On       : Mon Dec 12 15:56:07 2016
+// Last Modified By : Rob Schluntz
+// Last Modified On : Mon Dec 12 15:56:20 2016
+// Update Count     : 2
+//
+
+[char, int, double] f() { printf("ran f\n"); return ['c', 70, 6.28]; }
+
+int main() {
+  [int, char, float] x = [10, 'A', 3.14f];
+  printf("%d %c %g\n", ([int, char, float])x);
+  printf("%d %c\n", ([int, char])x);
+  printf("%d\n", ([int])x);
+  // printf("%d\n", (int)x);
+  printf("%g %g\n", ([double, float])x);
+  printf("%d %c\n", ([int, char])f());
+}
+
+// Local Variables: //
+// tab-width: 2 //
+// End: //
Index: tests/tuple/tupleFunction.c
===================================================================
--- tests/tuple/tupleFunction.c	(revision d5b2ac82c5d162b3f54cf7db3bdcbb3a48149204)
+++ 	(revision )
@@ -1,98 +1,0 @@
-//
-// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-//
-// tupleFunction.c --
-//
-// Author           : Rob Schluntz
-// Created On       : Tue Nov 15 17:24:32 2016
-// Last Modified By : Rob Schluntz
-// Last Modified On : Tue Nov 15 17:27:28 2016
-// Update Count     : 3
-//
-
-struct S {
-	int f1, f2;
-	char f3;
-	double f4;
-} v;
-
-[int] foo( [int, int, double, S] x ) {
-	printf("foo([%d, %d, %lg, {%d, %d, %c, %lg}])\n", x.0, x.1, x.2, x.3.[f1, f2, f3, f4]);
-	int a, b;
-	double c;
-	S d;
-	[a, b, c, d] = x;
-	[int, int, double, S] X = x;
-	printf("a=%d b=%d c=%lg d={%d, %d, %c, %lg}\n", a, b, c, d.[f1, f2, f3, f4]);
-	printf("X=[%d, %d, %lg, {%d, %d, %c, %lg}]\n", X.0, X.1, X.2, X.3.[f1, f2, f3, f4]);
-	return b;
-}
-
-[void] bar( [int, double, int] z ) {
-	printf("bar([%d, %lg, %d])\n", z);
-}
-
-[void] baz( int a, double b, int c ) {
-	printf("baz(%d, %lg, %d)\n", a, b, c);
-}
-
-[void] qux( [int, double] n, int m ) {
-	printf("qux([%d, %lg], %d)\n", n, m);
-}
-
-[int, double x, int] quux() {
-	return [3, 5.254, 4];
-}
-[[[int, double, int], [int, double]]] quuux() {
-	return [1, 2, 3, 4, 5];
-}
-
-int main() {
-	[int, double, int] x = [777, 2.76, 8675];
-	int x1 = 123, x3 = 456;
-	double x2 = 999.123;
-
-	printf("foo(...)=%d\n", foo(x1, x3, x2, (S){ 321, 654, 'Q', 3.14 }));
-
-	// call function with tuple parameter using tuple variable arg
-	bar(x);
-
-	// call function with tuple parameter using multiple values
-	bar(x1, x2, x3);
-
-	// call function with multiple parameters using tuple variable arg
-	baz(x);
-
-	// call function with multiple parameters using multiple args
-	baz(x1, x2, x3);
-
-	// call function with multiple parameters, one of which is a tuple using tuple variable arg
-	qux(x);
-
-	// call function with multiple parameters, one of which is a tuple using multiple args
-	qux(x1, x2, x3);
-
-	// call function with multiple return values and assign into a tuple variable
-	x = quux();
-	printf("x=[%d, %lg, %d]\n", x);
-
-	// call function with multiple return values and assign into a tuple expression
-	[x1, x2, x3] = quux();
-	printf("x1=%d x2=%lg x3=%d\n", x1, x2, x3);
-
-	// xxx - tuples of type parameters should come out as generic types?
-	// [x1, x2, x3] = ([(int)x1, (int)x2, (int)x3]) + ([(int)1, (int)2, (int)3]);
-	// ([(int)x1, (int)x2, (int)x3]) + ([(int)1, (int)2, (int)3]);
-	// printf("%d %g %d\n", x1, x2, x3);
-
-	// xxx - comes out the back as a cast, but should come out as a tuple expression of the first n fields cast to each of the result types
-	// ([int, double])x;
-}
-
-// Local Variables: //
-// tab-width: 4 //
-// End: //
-
Index: tests/tuple/tupleFunction.cfa
===================================================================
--- tests/tuple/tupleFunction.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
+++ tests/tuple/tupleFunction.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
@@ -0,0 +1,98 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// tupleFunction.c --
+//
+// Author           : Rob Schluntz
+// Created On       : Tue Nov 15 17:24:32 2016
+// Last Modified By : Rob Schluntz
+// Last Modified On : Tue Nov 15 17:27:28 2016
+// Update Count     : 3
+//
+
+struct S {
+	int f1, f2;
+	char f3;
+	double f4;
+} v;
+
+[int] foo( [int, int, double, S] x ) {
+	printf("foo([%d, %d, %lg, {%d, %d, %c, %lg}])\n", x.0, x.1, x.2, x.3.[f1, f2, f3, f4]);
+	int a, b;
+	double c;
+	S d;
+	[a, b, c, d] = x;
+	[int, int, double, S] X = x;
+	printf("a=%d b=%d c=%lg d={%d, %d, %c, %lg}\n", a, b, c, d.[f1, f2, f3, f4]);
+	printf("X=[%d, %d, %lg, {%d, %d, %c, %lg}]\n", X.0, X.1, X.2, X.3.[f1, f2, f3, f4]);
+	return b;
+}
+
+[void] bar( [int, double, int] z ) {
+	printf("bar([%d, %lg, %d])\n", z);
+}
+
+[void] baz( int a, double b, int c ) {
+	printf("baz(%d, %lg, %d)\n", a, b, c);
+}
+
+[void] qux( [int, double] n, int m ) {
+	printf("qux([%d, %lg], %d)\n", n, m);
+}
+
+[int, double x, int] quux() {
+	return [3, 5.254, 4];
+}
+[[[int, double, int], [int, double]]] quuux() {
+	return [1, 2, 3, 4, 5];
+}
+
+int main() {
+	[int, double, int] x = [777, 2.76, 8675];
+	int x1 = 123, x3 = 456;
+	double x2 = 999.123;
+
+	printf("foo(...)=%d\n", foo(x1, x3, x2, (S){ 321, 654, 'Q', 3.14 }));
+
+	// call function with tuple parameter using tuple variable arg
+	bar(x);
+
+	// call function with tuple parameter using multiple values
+	bar(x1, x2, x3);
+
+	// call function with multiple parameters using tuple variable arg
+	baz(x);
+
+	// call function with multiple parameters using multiple args
+	baz(x1, x2, x3);
+
+	// call function with multiple parameters, one of which is a tuple using tuple variable arg
+	qux(x);
+
+	// call function with multiple parameters, one of which is a tuple using multiple args
+	qux(x1, x2, x3);
+
+	// call function with multiple return values and assign into a tuple variable
+	x = quux();
+	printf("x=[%d, %lg, %d]\n", x);
+
+	// call function with multiple return values and assign into a tuple expression
+	[x1, x2, x3] = quux();
+	printf("x1=%d x2=%lg x3=%d\n", x1, x2, x3);
+
+	// xxx - tuples of type parameters should come out as generic types?
+	// [x1, x2, x3] = ([(int)x1, (int)x2, (int)x3]) + ([(int)1, (int)2, (int)3]);
+	// ([(int)x1, (int)x2, (int)x3]) + ([(int)1, (int)2, (int)3]);
+	// printf("%d %g %d\n", x1, x2, x3);
+
+	// xxx - comes out the back as a cast, but should come out as a tuple expression of the first n fields cast to each of the result types
+	// ([int, double])x;
+}
+
+// Local Variables: //
+// tab-width: 4 //
+// End: //
+
Index: tests/tuple/tupleMember.c
===================================================================
--- tests/tuple/tupleMember.c	(revision d5b2ac82c5d162b3f54cf7db3bdcbb3a48149204)
+++ 	(revision )
@@ -1,61 +1,0 @@
-//
-// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-//
-// tupleFunction.c --
-//
-// Author           : Rob Schluntz
-// Created On       : Tue Nov 15 17:24:32 2016
-// Last Modified By : Rob Schluntz
-// Last Modified On : Tue Nov 15 17:27:28 2016
-// Update Count     : 3
-//
-
-void f() {
-	printf("called f!\n");
-}
-
-double g(double x, char y, int z) {
-	return z-y+x;
-}
-
-struct V2	{
-	int f2, f3;
-};
-struct V {
-	int f1;
-	V2 i; // temporary
-	// struct V2 {
-	//   int f2, f3;
-	// } i;
-	double f4;
-} v;
-
-V & h() {
-	static V local = { 111, { 222, 333 }, 444.5 };
-	return local;
-}
-
-int main() {
-	struct X {
-		int a;
-		double b;
-		char c;
-	} x = { 10, 12.5, '\x9' };
-
-	// should only call f once
-	printf("g(...)=%lg\n", g((f(), x).[b, c, a]));
-
-	v.[f1, i.[f2, f3], f4].[1.0, 2, 0, 1.1] = [11, 3.14159, 12, 13];
-
-	printf("v.[f1, i.[f2, f3], f4]=[%d, %d, %d, %lg]\n", v.[f1, i.[f2, f3], f4]);
-
-	h().[f1, i.[f2, f3], f4].[1.0, 2, 0, 1.1] = [987, 6.28, 4, 2];
-	printf("v.[f1, i.[f2, f3], f4]=[%d, [%d, %d], %lg]\n", h().[f1, i.[f2, f3], f4]);
-}
-
-// Local Variables: //
-// tab-width: 4 //
-// End: //
Index: tests/tuple/tupleMember.cfa
===================================================================
--- tests/tuple/tupleMember.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
+++ tests/tuple/tupleMember.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
@@ -0,0 +1,61 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// tupleFunction.c --
+//
+// Author           : Rob Schluntz
+// Created On       : Tue Nov 15 17:24:32 2016
+// Last Modified By : Rob Schluntz
+// Last Modified On : Tue Nov 15 17:27:28 2016
+// Update Count     : 3
+//
+
+void f() {
+	printf("called f!\n");
+}
+
+double g(double x, char y, int z) {
+	return z-y+x;
+}
+
+struct V2	{
+	int f2, f3;
+};
+struct V {
+	int f1;
+	V2 i; // temporary
+	// struct V2 {
+	//   int f2, f3;
+	// } i;
+	double f4;
+} v;
+
+V & h() {
+	static V local = { 111, { 222, 333 }, 444.5 };
+	return local;
+}
+
+int main() {
+	struct X {
+		int a;
+		double b;
+		char c;
+	} x = { 10, 12.5, '\x9' };
+
+	// should only call f once
+	printf("g(...)=%lg\n", g((f(), x).[b, c, a]));
+
+	v.[f1, i.[f2, f3], f4].[1.0, 2, 0, 1.1] = [11, 3.14159, 12, 13];
+
+	printf("v.[f1, i.[f2, f3], f4]=[%d, %d, %d, %lg]\n", v.[f1, i.[f2, f3], f4]);
+
+	h().[f1, i.[f2, f3], f4].[1.0, 2, 0, 1.1] = [987, 6.28, 4, 2];
+	printf("v.[f1, i.[f2, f3], f4]=[%d, [%d, %d], %lg]\n", h().[f1, i.[f2, f3], f4]);
+}
+
+// Local Variables: //
+// tab-width: 4 //
+// End: //
Index: tests/tuple/tuplePolymorphism.c
===================================================================
--- tests/tuple/tuplePolymorphism.c	(revision d5b2ac82c5d162b3f54cf7db3bdcbb3a48149204)
+++ 	(revision )
@@ -1,74 +1,0 @@
-//
-// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-//
-// tuplePolymorphism.c --
-//
-// Author           : Rob Schluntz
-// Created On       : Tue Nov 16 10:38:00 2016
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Thu May 18 18:05:12 2017
-// Update Count     : 4
-//
-
-// packed is needed so that structs are not passed with the same alignment as function arguments
-__attribute__((packed)) struct A {
-	double x;
-	char y;
-	double z;
-};
-
-__attribute__((packed)) struct B {
-	long long x;
-	char y;
-	long long z;
-};
-
-// ensure that f is a viable candidate for g, even though its parameter structure does not exactly match
-[A] f([A, B] x, B y) { printf("%g %c %g %lld %c %lld %lld %c %lld\n", x.0.[x,y,z], x.1.[x,y,z], y.[x,y,z]); return x.0; }
-forall(otype T, otype U | { T f(T, U, U); })
-void g(T x, U y) { f(x, y, y); }
-
-// add two triples
-forall(otype T | { T ?+?(T, T); })
-[T, T, T] ?+?([T, T, T] x, [T, T, T] y) {
-	return [x.0+y.0, x.1+y.1, x.2+y.2];
-}
-
-int main() {
-	int x1 = 123, x3 = 456;
-	double x2 = 999.123;
-
-	int i1 = 111, i3 = 222;
-	double i2 = 333;
-
-	int d1 = 555, d3 = 444;
-	double d2 = 666;
-
-
-	[i1, i2, i3] = ([x1, (int)x2, x3]) + ([9, 2, 3]);
-	[d1, d2, d3] = ([x1, x2, x3]) + ([9, 2, 3]);
-	printf("%d %g %d\n", i1, i2, i3);
-	printf("%d %g %d\n", d1, d2, d3);
-
-	[double, double, double] zzz;
-	zzz = [x1, x2, x3];
-	printf("%g %g %g\n", zzz);
-	[x1, x2, x3] = zzz+zzz;
-	printf("%d %g %d\n", x1, x2, x3);
-
-	// ensure non-matching assertions are specialized correctly
-	g((A){ 1.21, 'x', 10.21}, (B){ 1111LL, 'v', 54385938LL });
-}
-
-forall(otype T)
-[T, T] foo([T, T] y) {
-	[T, T] x;
-	return x;
-}
-
-// Local Variables: //
-// tab-width: 4 //
-// End: //
Index: tests/tuple/tuplePolymorphism.cfa
===================================================================
--- tests/tuple/tuplePolymorphism.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
+++ tests/tuple/tuplePolymorphism.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
@@ -0,0 +1,74 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// tuplePolymorphism.c --
+//
+// Author           : Rob Schluntz
+// Created On       : Tue Nov 16 10:38:00 2016
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Thu May 18 18:05:12 2017
+// Update Count     : 4
+//
+
+// packed is needed so that structs are not passed with the same alignment as function arguments
+__attribute__((packed)) struct A {
+	double x;
+	char y;
+	double z;
+};
+
+__attribute__((packed)) struct B {
+	long long x;
+	char y;
+	long long z;
+};
+
+// ensure that f is a viable candidate for g, even though its parameter structure does not exactly match
+[A] f([A, B] x, B y) { printf("%g %c %g %lld %c %lld %lld %c %lld\n", x.0.[x,y,z], x.1.[x,y,z], y.[x,y,z]); return x.0; }
+forall(otype T, otype U | { T f(T, U, U); })
+void g(T x, U y) { f(x, y, y); }
+
+// add two triples
+forall(otype T | { T ?+?(T, T); })
+[T, T, T] ?+?([T, T, T] x, [T, T, T] y) {
+	return [x.0+y.0, x.1+y.1, x.2+y.2];
+}
+
+int main() {
+	int x1 = 123, x3 = 456;
+	double x2 = 999.123;
+
+	int i1 = 111, i3 = 222;
+	double i2 = 333;
+
+	int d1 = 555, d3 = 444;
+	double d2 = 666;
+
+
+	[i1, i2, i3] = ([x1, (int)x2, x3]) + ([9, 2, 3]);
+	[d1, d2, d3] = ([x1, x2, x3]) + ([9, 2, 3]);
+	printf("%d %g %d\n", i1, i2, i3);
+	printf("%d %g %d\n", d1, d2, d3);
+
+	[double, double, double] zzz;
+	zzz = [x1, x2, x3];
+	printf("%g %g %g\n", zzz);
+	[x1, x2, x3] = zzz+zzz;
+	printf("%d %g %d\n", x1, x2, x3);
+
+	// ensure non-matching assertions are specialized correctly
+	g((A){ 1.21, 'x', 10.21}, (B){ 1111LL, 'v', 54385938LL });
+}
+
+forall(otype T)
+[T, T] foo([T, T] y) {
+	[T, T] x;
+	return x;
+}
+
+// Local Variables: //
+// tab-width: 4 //
+// End: //
Index: tests/tuple/tupleVariadic.c
===================================================================
--- tests/tuple/tupleVariadic.c	(revision d5b2ac82c5d162b3f54cf7db3bdcbb3a48149204)
+++ 	(revision )
@@ -1,142 +1,0 @@
-//
-// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-//
-// tuplePolymorphism.c --
-//
-// Author           : Rob Schluntz
-// Created On       : Fri Dec 16 10:25:35 2016
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Thu Aug  2 09:24:04 2018
-// Update Count     : 6
-//
-
-#include <stdlib.hfa>
-
-void func(void) {
-	printf("called func(void)\n");
-}
-forall(otype T, ttype Params | { void process(T); void func(Params); })
-void func(T arg1, Params p) {
-	process(arg1);
-	func(p);
-}
-void process(int x) {
-	printf("called process(int) %d\n", x);
-}
-void process(double x) {
-	printf("called process(double) %g\n", x);
-}
-
-struct array {
-	int * data;
-	int size;
-};
-
-// xxx - eventually this will be collapsed...x
-void ?{}(array & a) {
-	a.size = 0;
-	a.data = 0;
-	printf("called ?{} with no a\n");
-}
-
-void ?{}(array & a, int a0) {
-	a.size = 1;
-	a.data = (int*)malloc(sizeof(int)*a.size);
-	a.data[0] = a0;
-	printf("called ?{} with a: %d\n", a0);
-}
-
-void ?{}(array & a, int a0, int a1) {
-	a.size = 2;
-	a.data = (int*)malloc(sizeof(int)*a.size);
-	a.data[0] = a0;
-	a.data[1] = a1;
-	printf("called ?{} with a: %d %d\n", a0, a1);
-}
-
-void ?{}(array & a, int a0, int a1, int a2) {
-	a.size = 3;
-	a.data = (int*)malloc(sizeof(int)*a.size);
-	a.data[0] = a0;
-	a.data[1] = a1;
-	a.data[2] = a2;
-	printf("called ?{} with a: %d %d %d\n", a0, a1, a2);
-}
-
-void ^?{}(array & a) {
-	free(a.data);
-}
-
-// test use of a tuple argument
-[void] ?{}(array & a, [int, int, int, int] args) {
-	int a0, a1, a2, a3;
-	[a0, a1, a2, a3] = args;
-	a.size = 4;
-	a.data = (int *)malloc(sizeof(int)*a.size);
-	a.data[0] = a0;
-	a.data[1] = a1;
-	a.data[2] = a2;
-	a.data[3] = a3;
-	printf("called ?{} with a: %d %d %d %d\n", a0, a1, a2, a3);
-}
-
-void print(array * x) {
-	printf("array = { ");
-	for (int i = 0; i < x->size; ++i) {
-		printf("%d, ", x->data[i]);
-	}
-	printf("}\n");
-}
-
-forall(otype T)
-T * copy(T x) {
-	// test calling new inside a polymorphic function
-	return new(x);
-}
-
-forall(ttype T | { void foo(T); }) void bar(T x) {}
-void foo(int) {}
-
-int main() {
-	array * x0 = new();
-	print(x0);
-
-	array * x1 = new(999);
-	print(x1);
-
-	array * x2 = new(123, 456);
-	print(x2);
-
-	array * x3 = new(100, 200, 300);
-	print(x3);
-
-	array * x4 = new(10, 2, 3, 4);
-	print(x4);
-
-	int * ptr = copy(111111);
-	printf("copy=%d\n", *ptr);
-
-	printf("calling func\n");
-	func(3, 2.0, 111, 4.145);
-	printf("finished func\n");
-
-	{
-		// T = [const int] -- this ensures that void(*)(int) satisfies void(*)(const int)
-		const int x;
-		bar(x);
-	}
-
-	delete(ptr);
-	delete(x4);
-	delete(x3);
-	delete(x2);
-	delete(x1);
-	delete(x0);
-}
-
-// Local Variables: //
-// tab-width: 4 //
-// End: //
Index: tests/tuple/tupleVariadic.cfa
===================================================================
--- tests/tuple/tupleVariadic.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
+++ tests/tuple/tupleVariadic.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
@@ -0,0 +1,142 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// tuplePolymorphism.c --
+//
+// Author           : Rob Schluntz
+// Created On       : Fri Dec 16 10:25:35 2016
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Thu Aug  2 09:24:04 2018
+// Update Count     : 6
+//
+
+#include <stdlib.hfa>
+
+void func(void) {
+	printf("called func(void)\n");
+}
+forall(otype T, ttype Params | { void process(T); void func(Params); })
+void func(T arg1, Params p) {
+	process(arg1);
+	func(p);
+}
+void process(int x) {
+	printf("called process(int) %d\n", x);
+}
+void process(double x) {
+	printf("called process(double) %g\n", x);
+}
+
+struct array {
+	int * data;
+	int size;
+};
+
+// xxx - eventually this will be collapsed...x
+void ?{}(array & a) {
+	a.size = 0;
+	a.data = 0;
+	printf("called ?{} with no a\n");
+}
+
+void ?{}(array & a, int a0) {
+	a.size = 1;
+	a.data = (int*)malloc(sizeof(int)*a.size);
+	a.data[0] = a0;
+	printf("called ?{} with a: %d\n", a0);
+}
+
+void ?{}(array & a, int a0, int a1) {
+	a.size = 2;
+	a.data = (int*)malloc(sizeof(int)*a.size);
+	a.data[0] = a0;
+	a.data[1] = a1;
+	printf("called ?{} with a: %d %d\n", a0, a1);
+}
+
+void ?{}(array & a, int a0, int a1, int a2) {
+	a.size = 3;
+	a.data = (int*)malloc(sizeof(int)*a.size);
+	a.data[0] = a0;
+	a.data[1] = a1;
+	a.data[2] = a2;
+	printf("called ?{} with a: %d %d %d\n", a0, a1, a2);
+}
+
+void ^?{}(array & a) {
+	free(a.data);
+}
+
+// test use of a tuple argument
+[void] ?{}(array & a, [int, int, int, int] args) {
+	int a0, a1, a2, a3;
+	[a0, a1, a2, a3] = args;
+	a.size = 4;
+	a.data = (int *)malloc(sizeof(int)*a.size);
+	a.data[0] = a0;
+	a.data[1] = a1;
+	a.data[2] = a2;
+	a.data[3] = a3;
+	printf("called ?{} with a: %d %d %d %d\n", a0, a1, a2, a3);
+}
+
+void print(array * x) {
+	printf("array = { ");
+	for (int i = 0; i < x->size; ++i) {
+		printf("%d, ", x->data[i]);
+	}
+	printf("}\n");
+}
+
+forall(otype T)
+T * copy(T x) {
+	// test calling new inside a polymorphic function
+	return new(x);
+}
+
+forall(ttype T | { void foo(T); }) void bar(T x) {}
+void foo(int) {}
+
+int main() {
+	array * x0 = new();
+	print(x0);
+
+	array * x1 = new(999);
+	print(x1);
+
+	array * x2 = new(123, 456);
+	print(x2);
+
+	array * x3 = new(100, 200, 300);
+	print(x3);
+
+	array * x4 = new(10, 2, 3, 4);
+	print(x4);
+
+	int * ptr = copy(111111);
+	printf("copy=%d\n", *ptr);
+
+	printf("calling func\n");
+	func(3, 2.0, 111, 4.145);
+	printf("finished func\n");
+
+	{
+		// T = [const int] -- this ensures that void(*)(int) satisfies void(*)(const int)
+		const int x;
+		bar(x);
+	}
+
+	delete(ptr);
+	delete(x4);
+	delete(x3);
+	delete(x2);
+	delete(x1);
+	delete(x0);
+}
+
+// Local Variables: //
+// tab-width: 4 //
+// End: //
Index: tests/tuple/tuples.c
===================================================================
--- tests/tuple/tuples.c	(revision d5b2ac82c5d162b3f54cf7db3bdcbb3a48149204)
+++ 	(revision )
@@ -1,32 +1,0 @@
-int a;
-float a;
-int f( int );
-float f( float );
-
-void g() {
-	// selects the same f each time but without a cast would be ambiguous
-	f( (int)a );
-	(int)f( a );
-}
-
-[ int ] p;
-[ int, double ] p;
-[ int, int, int ] p;
-[ int, int, int, int ] p;
-
-[ char ] q;
-[ int, int ] q;
-[ int, int, float ] q;
-[ int, int, int, int ] q;
-
-[ int, int ] r( int, int, int, int );
-
-void s() {
-	r( p, q );
-	r( [ q, p ] );
-	r( r( p, q ), r( q, q ) );
-}
-
-// Local Variables: //
-// tab-width: 4 //
-// End: //
Index: tests/tuple/tuples.cfa
===================================================================
--- tests/tuple/tuples.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
+++ tests/tuple/tuples.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
@@ -0,0 +1,32 @@
+int a;
+float a;
+int f( int );
+float f( float );
+
+void g() {
+	// selects the same f each time but without a cast would be ambiguous
+	f( (int)a );
+	(int)f( a );
+}
+
+[ int ] p;
+[ int, double ] p;
+[ int, int, int ] p;
+[ int, int, int, int ] p;
+
+[ char ] q;
+[ int, int ] q;
+[ int, int, float ] q;
+[ int, int, int, int ] q;
+
+[ int, int ] r( int, int, int, int );
+
+void s() {
+	r( p, q );
+	r( [ q, p ] );
+	r( r( p, q ), r( q, q ) );
+}
+
+// Local Variables: //
+// tab-width: 4 //
+// End: //
Index: tests/warnings/.expect/self-assignment.txt
===================================================================
--- tests/warnings/.expect/self-assignment.txt	(revision d5b2ac82c5d162b3f54cf7db3bdcbb3a48149204)
+++ tests/warnings/.expect/self-assignment.txt	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
@@ -1,25 +1,25 @@
-warnings/self-assignment.c:29:1 warning: self assignment of expression: Cast of:
+warnings/self-assignment.cfa:29:1 warning: self assignment of expression: Cast of:
   Variable Expression: j: signed int
 ... to:
   reference to signed int
-warnings/self-assignment.c:30:1 warning: self assignment of expression: Cast of:
-  Variable Expression: s: instance of struct S with body 1 
+warnings/self-assignment.cfa:30:1 warning: self assignment of expression: Cast of:
+  Variable Expression: s: instance of struct S with body 1
 ... to:
-  reference to instance of struct S with body 1 
-warnings/self-assignment.c:31:1 warning: self assignment of expression: Cast of:
-  Member Expression, with field: 
+  reference to instance of struct S with body 1
+warnings/self-assignment.cfa:31:1 warning: self assignment of expression: Cast of:
+  Member Expression, with field:
     i: signed int
-  ... from aggregate: 
-    Variable Expression: s: instance of struct S with body 1 
+  ... from aggregate:
+    Variable Expression: s: instance of struct S with body 1
 ... to:
   reference to signed int
-warnings/self-assignment.c:32:1 warning: self assignment of expression: Cast of:
-  Member Expression, with field: 
+warnings/self-assignment.cfa:32:1 warning: self assignment of expression: Cast of:
+  Member Expression, with field:
     i: signed int
-  ... from aggregate: 
-    Member Expression, with field: 
-      s: instance of struct S with body 1 
-    ... from aggregate: 
-      Variable Expression: t: instance of struct T with body 1 
+  ... from aggregate:
+    Member Expression, with field:
+      s: instance of struct S with body 1
+    ... from aggregate:
+      Variable Expression: t: instance of struct T with body 1
 ... to:
   reference to signed int
Index: tests/warnings/self-assignment.c
===================================================================
--- tests/warnings/self-assignment.c	(revision d5b2ac82c5d162b3f54cf7db3bdcbb3a48149204)
+++ 	(revision )
@@ -1,38 +1,0 @@
-//
-// Cforall Version 1.0.0 Copyright (C) 2018 University of Waterloo
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-//
-// self-assignment.c --
-//
-// Author           : Rob Schluntz
-// Created On       : Thu Mar 1 13:53:57 2018
-// Last Modified By : Rob Schluntz
-// Last Modified On : Thu Mar 1 13:53:57 2018
-// Update Count     : 2
-//
-
-struct S {
-  int i;
-};
-
-struct T {
-  S s;
-};
-
-int main() {
-  int j = 0;
-  S s = { 0 };
-  T t = { { 0 } };
-
-  j = j;
-  s = s;
-  s.i = s.i;
-  t.s.i = t.s.i;
-}
-
-// Local Variables: //
-// tab-width: 4 //
-// compile-command: "cfa dtor-early-exit" //
-// End: //
Index: tests/warnings/self-assignment.cfa
===================================================================
--- tests/warnings/self-assignment.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
+++ tests/warnings/self-assignment.cfa	(revision 456834bab8c511c181adb66426754ef2b7815b3c)
@@ -0,0 +1,38 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2018 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// self-assignment.c --
+//
+// Author           : Rob Schluntz
+// Created On       : Thu Mar 1 13:53:57 2018
+// Last Modified By : Rob Schluntz
+// Last Modified On : Thu Mar 1 13:53:57 2018
+// Update Count     : 2
+//
+
+struct S {
+  int i;
+};
+
+struct T {
+  S s;
+};
+
+int main() {
+  int j = 0;
+  S s = { 0 };
+  T t = { { 0 } };
+
+  j = j;
+  s = s;
+  s.i = s.i;
+  t.s.i = t.s.i;
+}
+
+// Local Variables: //
+// tab-width: 4 //
+// compile-command: "cfa dtor-early-exit" //
+// End: //
