Index: driver/cc1.cc
===================================================================
--- driver/cc1.cc	(revision d2b5d2d13fbbd91cca2e3529726480496ccb0577)
+++ driver/cc1.cc	(revision 794db28fedf4d56b2d4db3057c6825fe0fab19e9)
@@ -10,6 +10,6 @@
 // Created On       : Fri Aug 26 14:23:51 2005
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Thu Aug 13 21:03:15 2020
-// Update Count     : 407
+// Last Modified On : Sun Aug 16 21:03:02 2020
+// Update Count     : 413
 //
 
@@ -24,5 +24,5 @@
 #include <unistd.h>										// execvp, fork, unlink
 #include <sys/wait.h>									// wait
-#include <fcntl.h>
+#include <fcntl.h>										// creat
 
 
@@ -59,5 +59,5 @@
 
 
-static string __CFA_FLAGPREFIX__( "__CFA_FLAG" );		// "N__=" suffix
+static string __CFA_FLAGPREFIX__( "__CFA_FLAG" );		// "__CFA_FLAG__=" suffix
 
 static void checkEnv1( const char * args[], int & nargs ) { // stage 1
@@ -111,6 +111,7 @@
 } // checkEnv2
 
-
-static char tmpname[] = P_tmpdir "/CFAXXXXXX.ifa";
+#define CFA_SUFFIX ".ifa"
+
+static char tmpname[] = P_tmpdir "/CFAXXXXXX" CFA_SUFFIX;
 static int tmpfilefd = -1;
 static bool startrm = false;
@@ -321,9 +322,10 @@
 
 	if ( WIFSIGNALED(code) ) {							// child failed ?
+		rmtmpfile();									// remove tmpname
 		cerr << "CC1 Translator error: stage 1, child failed " << WTERMSIG(code) << endl;
 		exit( EXIT_FAILURE );
 	} // if
 
-	exit( WEXITSTATUS(code) );							// bad cpp result stops top-level gcc
+	exit( WEXITSTATUS( code ) );						// bad cpp result stops top-level gcc
 } // Stage1
 
@@ -373,9 +375,9 @@
 			} else if ( arg == "-fno-diagnostics-color" ) {
 				color_arg = Color_Auto;
-			}
+			} // if
 
 			if ( arg == "-quiet" || arg == "-version" || arg == "-fpreprocessed" ||
-				// Currently CFA does not suppose precompiled .h files.
-				prefix( arg, "--output-pch" ) ) {
+				 // Currently CFA does not suppose precompiled .h files.
+				 prefix( arg, "--output-pch" ) ) {
 
 				// strip inappropriate flags with an argument
@@ -441,5 +443,5 @@
 			} // if
 
-			cfa_cpp_out = cfa_cpp_out.substr( 0, dot ) + ".ifa";
+			cfa_cpp_out = cfa_cpp_out.substr( 0, dot ) + CFA_SUFFIX;
 			if ( creat( cfa_cpp_out.c_str(), 0666 ) == -1 ) {
 				perror( "CC1 Translator error: stage 2, creat" );
@@ -462,5 +464,5 @@
 	// output.  Otherwise, run the cfa-cpp preprocessor on the temporary file and save the result into the output file.
 
-	if ( fork() == 0 ) {								// child runs CFA
+	if ( fork() == 0 ) {								// child runs CFA preprocessor
 		cargs[0] = ( *new string( bprefix + "cfa-cpp" ) ).c_str();
 		cargs[ncargs++] = cpp_in;
@@ -520,5 +522,5 @@
 	#endif // __DEBUG_H__
 
-	if ( fork() == 0 ) {								// child runs CFA
+	if ( fork() == 0 ) {								// child runs gcc
 		args[0] = compiler_path.c_str();
 		args[nargs++] = "-S";							// only compile and put assembler output in specified file
Index: driver/cfa.cc
===================================================================
--- driver/cfa.cc	(revision d2b5d2d13fbbd91cca2e3529726480496ccb0577)
+++ driver/cfa.cc	(revision 794db28fedf4d56b2d4db3057c6825fe0fab19e9)
@@ -10,17 +10,16 @@
 // Created On       : Tue Aug 20 13:44:49 2002
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Thu Aug 13 17:22:02 2020
-// Update Count     : 435
+// Last Modified On : Sun Aug 16 23:05:59 2020
+// Update Count     : 447
 //
 
 #include <iostream>
-#include <cstdio>      // perror
-#include <cstdlib>     // putenv, exit
-#include <climits>     // PATH_MAX
-#include <unistd.h>    // execvp
-#include <string>      // STL version
-#include <string.h>    // strcmp
-#include <algorithm>   // find
-
+#include <cstdio>										// perror
+#include <cstdlib>										// putenv, exit
+#include <climits>										// PATH_MAX
+#include <string>										// STL version
+#include <algorithm>									// find
+
+#include <unistd.h>										// execvp
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -34,10 +33,12 @@
 using std::to_string;
 
-// #define __DEBUG_H__
-
-// "N__=" suffix
-static string __CFA_FLAGPREFIX__( "__CFA_FLAG" );
-
-void Putenv( char * argv[], string arg ) {
+//#define __DEBUG_H__
+
+#define xstr(s) str(s)
+#define str(s) #s
+
+static string __CFA_FLAGPREFIX__( "__CFA_FLAG" );		// "__CFA_FLAG__=" suffix
+
+static void Putenv( char * argv[], string arg ) {
 	// environment variables must have unique names
 	static int flags = 0;
@@ -49,10 +50,9 @@
 } // Putenv
 
-// check if string has prefix
-bool prefix( const string & arg, const string & pre ) {
+static bool prefix( const string & arg, const string & pre ) { // check if string has prefix
 	return arg.substr( 0, pre.size() ) == pre;
 } // prefix
 
-inline bool ends_with(const string & str, const string & sfix) {
+static inline bool ends_with(const string & str, const string & sfix) {
 	if (sfix.size() > str.size()) return false;
 	return std::equal(str.rbegin(), str.rbegin() + sfix.size(), sfix.rbegin(), sfix.rend());
@@ -60,5 +60,5 @@
 
 // check if string has suffix
-bool suffix( const string & arg ) {
+static bool suffix( const string & arg ) {
 	enum { NumSuffixes = 3 };
 	static const string suffixes[NumSuffixes] = { "cfa", "hfa", "ifa" };
@@ -70,5 +70,4 @@
 } // suffix
 
-
 static inline bool dirExists( const string & path ) {	// check if directory exists
     struct stat info;
@@ -79,5 +78,5 @@
 static inline string dir(const string & path) {
 	return path.substr(0, path.find_last_of('/'));
-}
+} // dir
 
 // Different path modes
@@ -118,7 +117,4 @@
 }
 
-
-#define xstr(s) str(s)
-#define str(s) #s
 
 int main( int argc, char * argv[] ) {
@@ -158,9 +154,9 @@
 	PathMode path = FromProc();
 
-	const char *args[argc + 100];						// cfa command line values, plus some space for additional flags
+	const char * args[argc + 100];						// cfa command line values, plus some space for additional flags
 	int sargs = 1;										// starting location for arguments in args list
 	int nargs = sargs;									// number of arguments in args list; 0 => command name
 
-	const char *libs[argc + 20];						// non-user libraries must come separately, plus some added libraries and flags
+	const char * libs[argc + 20];						// non-user libraries must come separately, plus some added libraries and flags
 	int nlibs = 0;
 
@@ -185,4 +181,7 @@
 				args[nargs++] = argv[i];				// pass argument along
 				if ( arg == "-o" ) o_file = i;			// remember file
+
+				// CFA specific arguments
+
 			} else if ( strncmp(arg.c_str(), "-XCFA", 5) == 0 ) { // CFA pass through
 				if ( arg.size() == 5 ) {
@@ -203,16 +202,16 @@
 			} else if ( arg == "-nodebug" ) {
 				debug = false;							// strip the nodebug flag
-			} else if ( arg == "-nolib" ) {
-				nolib = true;							// strip the nodebug flag
 			} else if ( arg == "-quiet" ) {
 				quiet = true;							// strip the quiet flag
 			} else if ( arg == "-noquiet" ) {
 				quiet = false;							// strip the noquiet flag
+			} else if ( arg == "-no-include-stdhdr" ) {
+				noincstd_flag = true;					// strip the no-include-stdhdr flag
+			} else if ( arg == "-nolib" ) {
+				nolib = true;							// strip the nolib flag
 			} else if ( arg == "-help" ) {
 				help = true;							// strip the help flag
 			} else if ( arg == "-nohelp" ) {
 				help = false;							// strip the nohelp flag
-			} else if ( arg == "-no-include-stdhdr" ) {
-				noincstd_flag = true;					// strip the no-include-stdhdr flag
 			} else if ( arg == "-cfalib") {
 				compiling_libs = true;
@@ -336,5 +335,5 @@
 	string libbase;
 	switch(path) {
-	case Installed:
+	  case Installed:
 		args[nargs++] = "-I" CFA_INCDIR;
 		// do not use during build
@@ -346,6 +345,6 @@
 		libbase = CFA_LIBDIR;
 		break;
-	case BuildTree:
-	case Distributed:
+	  case BuildTree:
+	  case Distributed:
 		args[nargs++] = "-I" TOP_SRCDIR "libcfa/src";
 		// do not use during build
@@ -381,5 +380,5 @@
 	string libdir = libbase + arch + "-" + config;
 
-	if (path != Distributed) {
+	if ( path != Distributed ) {
 		if ( ! nolib && ! dirExists( libdir ) ) {
 			cerr << argv[0] << " internal error, configuration " << config << " not installed." << endl;
@@ -401,8 +400,8 @@
 	string preludedir;
 	switch(path) {
-	case Installed   : preludedir = libdir; break;
-	case BuildTree   : preludedir = libdir + "/prelude"; break;
-	case Distributed : preludedir = dir(argv[0]); break;
-	}
+	  case Installed   : preludedir = libdir; break;
+	  case BuildTree   : preludedir = libdir + "/prelude"; break;
+	  case Distributed : preludedir = dir(argv[0]); break;
+	} // switch
 
 	Putenv( argv, "--prelude-dir=" + preludedir );
@@ -476,11 +475,11 @@
 	if ( bprefix.length() == 0 ) {
 		switch(path) {
-		case Installed   : bprefix = installlibdir; break;
-		case BuildTree   : bprefix = srcdriverdir ; break;
-		case Distributed : bprefix = dir(argv[0]) ; break;
-		}
-		if ( bprefix[bprefix.length() - 1] != '/' ) bprefix += '/';
-		Putenv( argv, string("-B=") + bprefix );
-	} // if
+		  case Installed   : bprefix = installlibdir; break;
+		  case BuildTree   : bprefix = srcdriverdir ; break;
+		  case Distributed : bprefix = dir(argv[0]) ; break;
+		} // switch
+	} // if
+	if ( bprefix[bprefix.length() - 1] != '/' ) bprefix += '/';
+	Putenv( argv, string("-B=") + bprefix );
 
 	args[nargs++] = "-Xlinker";							// used by backtrace
@@ -504,6 +503,6 @@
 		args[nargs++] = "-Wno-cast-function-type";
 		#endif // HAVE_CAST_FUNCTION_TYPE
-		if ( ! std_flag ) {								// default c11, if none specified
-			args[nargs++] = "-std=gnu11";
+		if ( ! std_flag && ! x_flag ) {
+			args[nargs++] = "-std=gnu11";				// default c11, if none specified
 		} // if
 		args[nargs++] = "-fgnu89-inline";
@@ -555,5 +554,5 @@
 	// execute the command and return the result
 
-	execvp( args[0], (char *const *)args );				// should not return
+	execvp( args[0], (char * const *)args );			// should not return
 	perror( "CFA Translator error: execvp" );
 	exit( EXIT_FAILURE );
Index: libcfa/src/common.hfa
===================================================================
--- libcfa/src/common.hfa	(revision d2b5d2d13fbbd91cca2e3529726480496ccb0577)
+++ libcfa/src/common.hfa	(revision 794db28fedf4d56b2d4db3057c6825fe0fab19e9)
@@ -10,6 +10,6 @@
 // Created On       : Wed Jul 11 17:54:36 2018
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Thu Jul 12 08:02:18 2018
-// Update Count     : 5
+// Last Modified On : Sat Aug 15 08:51:29 2020
+// Update Count     : 14
 // 
 
@@ -67,7 +67,13 @@
 
 static inline {
+	char min( char t1, char t2 ) { return t1 < t2 ? t1 : t2; } // optimization
+	intptr_t min( intptr_t t1, intptr_t t2 ) { return t1 < t2 ? t1 : t2; } // optimization
+	uintptr_t min( uintptr_t t1, uintptr_t t2 ) { return t1 < t2 ? t1 : t2; } // optimization
 	forall( otype T | { int ?<?( T, T ); } )
 	T min( T t1, T t2 ) { return t1 < t2 ? t1 : t2; }
 
+	char max( char t1, char t2 ) { return t1 > t2 ? t1 : t2; } // optimization
+	intptr_t max( intptr_t t1, intptr_t t2 ) { return t1 > t2 ? t1 : t2; } // optimization
+	uintptr_t max( uintptr_t t1, uintptr_t t2 ) { return t1 > t2 ? t1 : t2; } // optimization
 	forall( otype T | { int ?>?( T, T ); } )
 	T max( T t1, T t2 ) { return t1 > t2 ? t1 : t2; }
Index: libcfa/src/concurrency/coroutine.cfa
===================================================================
--- libcfa/src/concurrency/coroutine.cfa	(revision d2b5d2d13fbbd91cca2e3529726480496ccb0577)
+++ libcfa/src/concurrency/coroutine.cfa	(revision 794db28fedf4d56b2d4db3057c6825fe0fab19e9)
@@ -215,4 +215,8 @@
 		return cor;
 	}
+
+	struct $coroutine * __cfactx_cor_active(void) {
+		return active_coroutine();
+	}
 }
 
Index: libcfa/src/concurrency/invoke.c
===================================================================
--- libcfa/src/concurrency/invoke.c	(revision d2b5d2d13fbbd91cca2e3529726480496ccb0577)
+++ libcfa/src/concurrency/invoke.c	(revision 794db28fedf4d56b2d4db3057c6825fe0fab19e9)
@@ -29,4 +29,5 @@
 // Called from the kernel when starting a coroutine or task so must switch back to user mode.
 
+extern struct $coroutine * __cfactx_cor_active(void);
 extern struct $coroutine * __cfactx_cor_finish(void);
 extern void __cfactx_cor_leave ( struct $coroutine * );
@@ -35,4 +36,8 @@
 extern void disable_interrupts() OPTIONAL_THREAD;
 extern void enable_interrupts( __cfaabi_dbg_ctx_param );
+
+struct exception_context_t * this_exception_context() {
+	return &__get_stack( __cfactx_cor_active() )->exception_context;
+}
 
 void __cfactx_invoke_coroutine(
Index: libcfa/src/concurrency/invoke.h
===================================================================
--- libcfa/src/concurrency/invoke.h	(revision d2b5d2d13fbbd91cca2e3529726480496ccb0577)
+++ libcfa/src/concurrency/invoke.h	(revision 794db28fedf4d56b2d4db3057c6825fe0fab19e9)
@@ -98,4 +98,6 @@
 	}
 
+	struct exception_context_t * this_exception_context();
+
 	// struct which calls the monitor is accepting
 	struct __waitfor_mask_t {
Index: libcfa/src/exception.c
===================================================================
--- libcfa/src/exception.c	(revision d2b5d2d13fbbd91cca2e3529726480496ccb0577)
+++ libcfa/src/exception.c	(revision 794db28fedf4d56b2d4db3057c6825fe0fab19e9)
@@ -59,11 +59,9 @@
 
 
-// Temperary global exception context. Does not work with concurency.
-static struct exception_context_t shared_stack = {NULL, NULL};
-
 // Get the current exception context.
 // There can be a single global until multithreading occurs, then each stack
-// needs its own. It will have to be updated to handle that.
-struct exception_context_t * this_exception_context() {
+// needs its own. We get this from libcfathreads (no weak attribute).
+__attribute__((weak)) struct exception_context_t * this_exception_context() {
+	static struct exception_context_t shared_stack = {NULL, NULL};
 	return &shared_stack;
 }
Index: libcfa/src/heap.cfa
===================================================================
--- libcfa/src/heap.cfa	(revision d2b5d2d13fbbd91cca2e3529726480496ccb0577)
+++ libcfa/src/heap.cfa	(revision 794db28fedf4d56b2d4db3057c6825fe0fab19e9)
@@ -10,6 +10,6 @@
 // Created On       : Tue Dec 19 21:58:35 2017
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Sun Aug  9 12:23:20 2020
-// Update Count     : 894
+// Last Modified On : Wed Aug 12 16:43:38 2020
+// Update Count     : 902
 //
 
@@ -650,5 +650,8 @@
 		for ( HeapManager.Storage * p = freeLists[i].freeList; p != 0p; p = p->header.kind.real.next ) {
 		#else
-		for ( HeapManager.Storage * p = top( freeLists[i].freeList ); p != 0p; p = (p)`next->top ) {
+		// for ( HeapManager.Storage * p = top( freeLists[i].freeList ); p != 0p; p = (p)`next->top ) {
+		for ( HeapManager.Storage * p = top( freeLists[i].freeList ); p != 0p; /* p = getNext( p )->top */) {
+			typeof(p) temp = (( p )`next)->top;			// FIX ME: direct assignent fails, initialization works
+			p = temp;
 		#endif // BUCKETLOCK
 			total += size;
@@ -1162,5 +1165,5 @@
 		choose( option ) {
 		  case M_TOP_PAD:
-			heapExpand = ceiling( value, pageSize ); return 1;
+			heapExpand = ceiling2( value, pageSize ); return 1;
 		  case M_MMAP_THRESHOLD:
 			if ( setMmapStart( value ) ) return 1;
Index: libcfa/src/stdlib.hfa
===================================================================
--- libcfa/src/stdlib.hfa	(revision d2b5d2d13fbbd91cca2e3529726480496ccb0577)
+++ libcfa/src/stdlib.hfa	(revision 794db28fedf4d56b2d4db3057c6825fe0fab19e9)
@@ -10,6 +10,6 @@
 // Created On       : Thu Jan 28 17:12:35 2016
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Tue Aug 11 21:11:46 2020
-// Update Count     : 495
+// Last Modified On : Fri Aug 14 23:38:50 2020
+// Update Count     : 504
 //
 
@@ -39,4 +39,8 @@
 //---------------------------------------
 
+#include "common.hfa"
+
+//---------------------------------------
+
 // Macro because of returns
 #define $VAR_ALLOC( allocation, alignment ) \
@@ -152,6 +156,6 @@
 	} // alloc_set
 
-	T * alloc_set( size_t dim, const T fill[] ) {
-		return (T *)memcpy( (T *)alloc( dim ), fill, dim * sizeof(T) ); // initialize with fill value
+	T * alloc_set( size_t dimNew, const T fill[], size_t dimOld ) {
+		return (T *)memcpy( (T *)alloc( dimNew ), fill, min( dimNew, dimOld ) * sizeof(T) ); // initialize with fill value
 	} // alloc_set
 
@@ -220,6 +224,6 @@
 	} // alloc_align_set
 
-	T * alloc_align_set( size_t align, size_t dim, const T fill[] ) {
-		return (T *)memcpy( (T *)alloc_align( align, dim ), fill, dim * sizeof(T) );
+	T * alloc_align_set( size_t align, size_t dimNew, const T fill[], size_t dimOld ) {
+		return (T *)memcpy( (T *)alloc_align( align, dimNew ), fill, min( dimNew, dimOld ) * sizeof(T) );
 	} // alloc_align_set
 
@@ -374,8 +378,4 @@
 //---------------------------------------
 
-#include "common.hfa"
-
-//---------------------------------------
-
 extern bool threading_enabled(void) OPTIONAL_THREAD;
 
Index: tests/.expect/minmax.txt
===================================================================
--- tests/.expect/minmax.txt	(revision d2b5d2d13fbbd91cca2e3529726480496ccb0577)
+++ tests/.expect/minmax.txt	(revision 794db28fedf4d56b2d4db3057c6825fe0fab19e9)
@@ -1,8 +1,8 @@
 char			z a	min a
-signed int		4 3	min 3
+signed int		4 -3	min -3
 unsigned int		4 3	min 3
-signed long int		4 3	min 3
+signed long int		4 -3	min -3
 unsigned long int	4 3	min 3
-signed long long int	4 3	min 3
+signed long long int	4 -3	min -3
 unsigned long long int	4 3	min 3
 float			4. 3.1	min 3.1
@@ -11,9 +11,9 @@
 
 char			z a	max z
-signed int		4 3	max 4
+signed int		4 -3	max 4
 unsigned int		4 3	max 4
-signed long int		4 3	max 4
+signed long int		4 -3	max 4
 unsigned long int	4 3	max 4
-signed long long int	4 3	max 4
+signed long long int	4 -3	max 4
 unsigned long long int	4 3	max 4
 float			4. 3.1	max 4.
Index: tests/Makefile.am
===================================================================
--- tests/Makefile.am	(revision d2b5d2d13fbbd91cca2e3529726480496ccb0577)
+++ tests/Makefile.am	(revision 794db28fedf4d56b2d4db3057c6825fe0fab19e9)
@@ -163,4 +163,11 @@
 	$(CFACOMPILETEST) -DERR2 -c -fsyntax-only -o $(abspath ${@})
 
+# Exception Tests
+# Test with libcfathread; it changes how storage works.
+
+exceptions/%-threads : exceptions/%.cfa $(CFACCBIN)
+	$(CFACOMPILETEST) -include exceptions/with-threads.hfa -c -o $(abspath ${@}).o
+	$(CFACCLOCAL) $($(shell echo "${@}_FLAGSLD" | sed 's/-\|\//_/g')) $(abspath ${@}).o -o $(abspath ${@})
+
 #------------------------------------------------------------------------------
 # Other targets
Index: tests/alloc.cfa
===================================================================
--- tests/alloc.cfa	(revision d2b5d2d13fbbd91cca2e3529726480496ccb0577)
+++ tests/alloc.cfa	(revision 794db28fedf4d56b2d4db3057c6825fe0fab19e9)
@@ -10,6 +10,6 @@
 // Created On       : Wed Feb  3 07:56:22 2016
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Mon Apr  6 21:08:23 2020
-// Update Count     : 428
+// Last Modified On : Fri Aug 14 16:59:59 2020
+// Update Count     : 430
 //
 
@@ -90,5 +90,5 @@
 	// do not free
 
-	ip1 = alloc_set( 2 * dim, ip );						// CFA array alloc, fill
+	ip1 = alloc_set( 2 * dim, ip, 2 * dim );				// CFA array alloc, fill
 	printf( "CFA array alloc, fill from array\n" );
 	for ( i; 2 * dim ) { printf( "%#x %#x, ", ip[i], ip1[i] ); }
@@ -288,5 +288,5 @@
 	// do not free
 
-	stp1 = alloc_align_set( Alignment, dim, stp );		// CFA array memalign, fill
+	stp1 = alloc_align_set( Alignment, dim, stp, dim );	// CFA array memalign, fill
 	assert( (uintptr_t)stp % Alignment == 0 );
 	printf( "CFA array alloc_align, fill array\n" );
Index: tests/exceptions/.expect/conditional-threads.txt
===================================================================
--- tests/exceptions/.expect/conditional-threads.txt	(revision 794db28fedf4d56b2d4db3057c6825fe0fab19e9)
+++ tests/exceptions/.expect/conditional-threads.txt	(revision 794db28fedf4d56b2d4db3057c6825fe0fab19e9)
@@ -0,0 +1,2 @@
+Caught num_error: expected=2 actual=2.
+Caught num_error: expected=2 actual=2.
Index: tests/exceptions/.expect/defaults-threads.txt
===================================================================
--- tests/exceptions/.expect/defaults-threads.txt	(revision 794db28fedf4d56b2d4db3057c6825fe0fab19e9)
+++ tests/exceptions/.expect/defaults-threads.txt	(revision 794db28fedf4d56b2d4db3057c6825fe0fab19e9)
@@ -0,0 +1,10 @@
+Should be printed.
+jump catch handler.
+jump default handler.
+Catch unhandled_exception.
+cross terminate throw
+cross terminate default
+cross terminate catch
+cross resume throw
+cross resume default
+cross resume catch
Index: tests/exceptions/.expect/finally-threads.txt
===================================================================
--- tests/exceptions/.expect/finally-threads.txt	(revision 794db28fedf4d56b2d4db3057c6825fe0fab19e9)
+++ tests/exceptions/.expect/finally-threads.txt	(revision 794db28fedf4d56b2d4db3057c6825fe0fab19e9)
@@ -0,0 +1,21 @@
+termination throw
+finally during unwind
+Exiting: termination inner finally
+termination catch
+finally after catch
+Exiting: termination outer finally
+
+resumption throw
+resumption catch
+finally after resume
+Exiting: resumption inner finally
+finally after catch
+Exiting: resumption outer finally
+
+walking out of try
+walking through finally
+Exiting: walking finally
+
+jumping out of try
+jumping through finally
+Exiting: jumping finally
Index: tests/exceptions/.expect/resume-threads.txt
===================================================================
--- tests/exceptions/.expect/resume-threads.txt	(revision 794db28fedf4d56b2d4db3057c6825fe0fab19e9)
+++ tests/exceptions/.expect/resume-threads.txt	(revision 794db28fedf4d56b2d4db3057c6825fe0fab19e9)
@@ -0,0 +1,36 @@
+simple throw
+simple catch
+Exiting: simple catch clause
+end of try clause
+Exiting: simple try clause
+
+catch-all
+
+throwing child exception
+inner parent match
+
+caught yin as yin
+
+rethrow inner try
+caught throw, will rethrow
+Exiting: rethrowing catch clause
+caught rethrow
+Exiting: rethrow catch clause
+Exiting: rethrow inner try
+
+caught yin, will throw yang
+caught yang
+
+throwing first exception
+caught first exception
+throwing second exception
+caught second exception
+recaught first exception
+
+inner catch
+inner catch
+outer catch
+
+throw
+rethrow
+handle
Index: tests/exceptions/.expect/terminate-threads.txt
===================================================================
--- tests/exceptions/.expect/terminate-threads.txt	(revision 794db28fedf4d56b2d4db3057c6825fe0fab19e9)
+++ tests/exceptions/.expect/terminate-threads.txt	(revision 794db28fedf4d56b2d4db3057c6825fe0fab19e9)
@@ -0,0 +1,34 @@
+simple throw
+Exiting: simple try clause
+simple catch
+Exiting: simple catch clause
+
+catch-all
+
+throwing child exception
+inner parent match
+
+caught yin as yin
+
+rethrow inner try
+Exiting: rethrow inner try
+caught throw, will rethrow
+Exiting: rethrowing catch clause
+caught rethrow
+Exiting: rethrow catch clause
+
+caught yin, will throw yang
+caught yang
+
+throwing first exception
+caught first exception
+throwing second exception
+caught second exception
+recaught first exception
+
+inner catch
+outer catch
+
+throw
+rethrow
+handle
Index: tests/exceptions/terminate.cfa
===================================================================
--- tests/exceptions/terminate.cfa	(revision d2b5d2d13fbbd91cca2e3529726480496ccb0577)
+++ tests/exceptions/terminate.cfa	(revision 794db28fedf4d56b2d4db3057c6825fe0fab19e9)
@@ -142,3 +142,2 @@
 	}
 }
-
Index: tests/exceptions/with-threads.hfa
===================================================================
--- tests/exceptions/with-threads.hfa	(revision 794db28fedf4d56b2d4db3057c6825fe0fab19e9)
+++ tests/exceptions/with-threads.hfa	(revision 794db28fedf4d56b2d4db3057c6825fe0fab19e9)
@@ -0,0 +1,8 @@
+// Header used to force linking with libcfathread.
+
+// I know its "with threads" but a coroutine is enough to bring it all in.
+#include <coroutine.hfa>
+
+coroutine DummyCoroutine {};
+
+DummyCoroutine ignored_dummy_coroutine;
Index: tests/heap.cfa
===================================================================
--- tests/heap.cfa	(revision d2b5d2d13fbbd91cca2e3529726480496ccb0577)
+++ tests/heap.cfa	(revision 794db28fedf4d56b2d4db3057c6825fe0fab19e9)
@@ -10,6 +10,6 @@
 // Created On       : Tue Nov  6 17:54:56 2018
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Tue Aug  4 06:36:17 2020
-// Update Count     : 56
+// Last Modified On : Sun Aug  9 08:05:16 2020
+// Update Count     : 57
 // 
 
@@ -232,14 +232,11 @@
 		size_t s = i + default_mmap_start();			// cross over point
 		char * area = (char *)calloc( 1, s );
-// 		if ( area == 0p ) abort( "calloc/realloc/free out of memory" );
 		if ( area[0] != '\0' || area[s - 1] != '\0' ||
 			 area[malloc_size( area ) - 1] != '\0' ||
-			 ! malloc_zero_fill( area ) ) //abort( "calloc/realloc/free corrupt storage3" );
-			printf( "C %zd %d %d %d %d\n", s, area[0] != '\0', area[s - 1] != '\0', area[malloc_size( area ) - 1] != '\0', ! malloc_zero_fill( area ) );
+			 ! malloc_zero_fill( area ) ) abort( "calloc/realloc/free corrupt storage3" );
 
 		// Do not start this loop index at 0 because realloc of 0 bytes frees the storage.
 		for ( r; i ~ 256 * 1024 ~ 26 ) {				// start at initial memory request
 			area = (char *)realloc( area, r );			// attempt to reuse storage
-// 			if ( area == 0p ) abort( "calloc/realloc/free out of memory" );
 			if ( area[0] != '\0' || area[r - 1] != '\0' ||
 				 area[malloc_size( area ) - 1] != '\0' ||
@@ -255,5 +252,4 @@
 		// initial N byte allocation
 		char * area = (char *)memalign( a, amount );	// aligned N-byte allocation
-// 		if ( area == 0p ) abort( "memalign/realloc/free out of memory" ); // no storage ?
 		//sout | alignments[a] | area;
 		if ( (size_t)area % a != 0 || malloc_alignment( area ) != a ) { // check for initial alignment
Index: tests/linking/.expect/exception-nothreads.txt
===================================================================
--- tests/linking/.expect/exception-nothreads.txt	(revision 794db28fedf4d56b2d4db3057c6825fe0fab19e9)
+++ tests/linking/.expect/exception-nothreads.txt	(revision 794db28fedf4d56b2d4db3057c6825fe0fab19e9)
@@ -0,0 +1,1 @@
+no threads
Index: tests/linking/.expect/exception-withthreads.txt
===================================================================
--- tests/linking/.expect/exception-withthreads.txt	(revision 794db28fedf4d56b2d4db3057c6825fe0fab19e9)
+++ tests/linking/.expect/exception-withthreads.txt	(revision 794db28fedf4d56b2d4db3057c6825fe0fab19e9)
@@ -0,0 +1,1 @@
+with threads
Index: tests/linking/exception-nothreads.cfa
===================================================================
--- tests/linking/exception-nothreads.cfa	(revision 794db28fedf4d56b2d4db3057c6825fe0fab19e9)
+++ tests/linking/exception-nothreads.cfa	(revision 794db28fedf4d56b2d4db3057c6825fe0fab19e9)
@@ -0,0 +1,33 @@
+//
+// 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.
+//
+// exception-nothreads.cfa --
+//
+// Author           : Andrew Beach
+// Created On       : Thr 13 16:12:00 2020
+// Last Modified By : Andrew Beach
+// Last Modified On : Thr 13 16:49:00 2020
+// Update Count     : 0
+//
+
+#include <stdlib.hfa>
+#include <exception.hfa>
+
+TRIVIAL_EXCEPTION(ping);
+
+int main(void) {
+	try {
+		throwResume (ping){};
+	} catchResume (ping *) {
+		printf("%s threads\n", threading_enabled() ? "with" : "no");
+	}
+	return 0;
+}
+
+// Local Variables: //
+// tab-width: 4 //
+// compile-command: "cfa nothreads.cfa" //
+// End: //
Index: tests/linking/exception-withthreads.cfa
===================================================================
--- tests/linking/exception-withthreads.cfa	(revision 794db28fedf4d56b2d4db3057c6825fe0fab19e9)
+++ tests/linking/exception-withthreads.cfa	(revision 794db28fedf4d56b2d4db3057c6825fe0fab19e9)
@@ -0,0 +1,34 @@
+//
+// 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.
+//
+// exception-withthreads.cfa --
+//
+// Author           : Andrew Beach
+// Created On       : Thr 13 16:12:00 2020
+// Last Modified By : Andrew Beach
+// Last Modified On : Fri 14 11:20:00 2020
+// Update Count     : 0
+//
+
+#include <stdlib.hfa>
+#include <exception.hfa>
+#include "../exceptions/with-threads.hfa"
+
+TRIVIAL_EXCEPTION(ping);
+
+int main(void) {
+	try {
+		throwResume (ping){};
+	} catchResume (ping *) {
+		printf("%s threads\n", threading_enabled() ? "with" : "no");
+	}
+	return 0;
+}
+
+// Local Variables: //
+// tab-width: 4 //
+// compile-command: "cfa nothreads.cfa" //
+// End: //
Index: tests/linking/withthreads.cfa
===================================================================
--- tests/linking/withthreads.cfa	(revision d2b5d2d13fbbd91cca2e3529726480496ccb0577)
+++ tests/linking/withthreads.cfa	(revision 794db28fedf4d56b2d4db3057c6825fe0fab19e9)
@@ -5,5 +5,5 @@
 // file "LICENCE" distributed with Cforall.
 //
-// nothreads.cfa --
+// withthreads.cfa --
 //
 // Author           : Thierry Delisle
Index: tests/minmax.cfa
===================================================================
--- tests/minmax.cfa	(revision d2b5d2d13fbbd91cca2e3529726480496ccb0577)
+++ tests/minmax.cfa	(revision 794db28fedf4d56b2d4db3057c6825fe0fab19e9)
@@ -10,6 +10,6 @@
 // Created On       : Wed May 27 17:56:53 2015
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Tue Dec  4 21:45:31 2018
-// Update Count     : 52
+// Last Modified On : Sat Aug 15 08:28:01 2020
+// Update Count     : 54
 //
 
@@ -23,9 +23,9 @@
 
 	sout | "char\t\t\t"					| 'z' | ' ' | 'a' | "\tmin " | min( 'z', 'a' );
-	sout | "signed int\t\t"				| 4 | 3 | "\tmin" | min( 4, 3 );
+	sout | "signed int\t\t"				| 4 | -3 | "\tmin" | min( 4, -3 );
 	sout | "unsigned int\t\t"			| 4u | 3u | "\tmin" | min( 4u, 3u );
-	sout | "signed long int\t\t" 		| 4l | 3l | "\tmin" | min( 4l, 3l );
+	sout | "signed long int\t\t" 		| 4l | -3l | "\tmin" | min( 4l, -3l );
 	sout | "unsigned long int\t" 		| 4ul | 3ul | "\tmin" | min( 4ul, 3ul );
-	sout | "signed long long int\t"		| 4ll | 3ll | "\tmin" | min( 4ll, 3ll );
+	sout | "signed long long int\t"		| 4ll | -3ll | "\tmin" | min( 4ll, -3ll );
 	sout | "unsigned long long int\t"	| 4ull | 3ull | "\tmin" | min( 4ull, 3ull );
 	sout | "float\t\t\t" 				| 4.0f | 3.1f | "\tmin" | min( 4.0f, 3.1f );
@@ -36,9 +36,9 @@
 
 	sout | "char\t\t\t"					| 'z' | ' ' | 'a' | "\tmax " | max( 'z', 'a' );
-	sout | "signed int\t\t"				| 4 | 3 | "\tmax" | max( 4, 3 );
+	sout | "signed int\t\t"				| 4 | -3 | "\tmax" | max( 4, -3 );
 	sout | "unsigned int\t\t"			| 4u | 3u | "\tmax" | max( 4u, 3u );
-	sout | "signed long int\t\t" 		| 4l | 3l | "\tmax" | max( 4l, 3l );
+	sout | "signed long int\t\t" 		| 4l | -3l | "\tmax" | max( 4l, -3l );
 	sout | "unsigned long int\t" 		| 4ul | 3ul | "\tmax" | max( 4ul, 3ul );
-	sout | "signed long long int\t"		| 4ll | 3ll | "\tmax" | max( 4ll, 3ll );
+	sout | "signed long long int\t"		| 4ll | -3ll | "\tmax" | max( 4ll, -3ll );
 	sout | "unsigned long long int\t"	| 4ull | 3ull | "\tmax" | max( 4ull, 3ull );
 	sout | "float\t\t\t" 				| 4.0f | 3.1f | "\tmax" | max( 4.0f, 3.1f );
