Index: src/CodeGen/Generate.cc
===================================================================
--- src/CodeGen/Generate.cc	(revision e7cc8cb477d1030eb38a612a1830c48cd7085bec)
+++ src/CodeGen/Generate.cc	(revision a98b2cca9704d45e2cb19838871a79c1c794fcd6)
@@ -22,4 +22,5 @@
 #include "SynTree/Declaration.h"
 #include "CodeGenerator.h"
+#include "Tuples/Tuples.h"
 
 using namespace std;
@@ -28,9 +29,8 @@
 	void generate( std::list< Declaration* > translationUnit, std::ostream &os, bool doIntrinsics, bool pretty ) {
 		CodeGen::CodeGenerator cgv( os, pretty );
-
-		for ( std::list<Declaration *>::iterator i = translationUnit.begin(); i != translationUnit.end();  i++ ) {
-			if ( LinkageSpec::isGeneratable( (*i)->get_linkage() ) && (doIntrinsics || ! LinkageSpec::isBuiltin( (*i)->get_linkage() ) ) ) {
-				(*i)->accept(cgv);
-				if ( doSemicolon( *i ) ) {
+		for ( auto & dcl : translationUnit ) {
+			if ( LinkageSpec::isGeneratable( dcl->get_linkage() ) && (doIntrinsics || ! LinkageSpec::isBuiltin( dcl->get_linkage() ) ) ) {
+				dcl->accept(cgv);
+				if ( doSemicolon( dcl ) ) {
 					os << ";";
 				} // if
Index: src/InitTweak/FixInit.cc
===================================================================
--- src/InitTweak/FixInit.cc	(revision e7cc8cb477d1030eb38a612a1830c48cd7085bec)
+++ src/InitTweak/FixInit.cc	(revision a98b2cca9704d45e2cb19838871a79c1c794fcd6)
@@ -1116,4 +1116,6 @@
 			// xxx - is the size check necessary?
 			assert( ctorExpr->has_result() && ctorExpr->get_result()->size() == 1 );
+
+			// xxx - ideally we would reuse the temporary generated from the copy constructor passes from within firstArg if it exists and not generate a temporary if it's unnecessary.
 			ObjectDecl * tmp = new ObjectDecl( tempNamer.newName(), DeclarationNode::NoStorageClass, LinkageSpec::C, nullptr, ctorExpr->get_result()->clone(), nullptr );
 			addDeclaration( tmp );
Index: src/InitTweak/InitTweak.cc
===================================================================
--- src/InitTweak/InitTweak.cc	(revision e7cc8cb477d1030eb38a612a1830c48cd7085bec)
+++ src/InitTweak/InitTweak.cc	(revision a98b2cca9704d45e2cb19838871a79c1c794fcd6)
@@ -332,4 +332,13 @@
 			return nullptr;
 		}
+	}
+
+	DeclarationWithType * getFunction( Expression * expr ) {
+		if ( ApplicationExpr * appExpr = dynamic_cast< ApplicationExpr * >( expr ) ) {
+			return getCalledFunction( appExpr->get_function() );
+		} else if ( UntypedExpr * untyped = dynamic_cast< UntypedExpr * > ( expr ) ) {
+			return getCalledFunction( untyped->get_function() );
+		}
+		assertf( false, "getFunction received unknown expression: %s", toString( expr ).c_str() );
 	}
 
Index: src/InitTweak/InitTweak.h
===================================================================
--- src/InitTweak/InitTweak.h	(revision e7cc8cb477d1030eb38a612a1830c48cd7085bec)
+++ src/InitTweak/InitTweak.h	(revision a98b2cca9704d45e2cb19838871a79c1c794fcd6)
@@ -51,6 +51,9 @@
 	bool checkInitDepth( ObjectDecl * objDecl );
 
-  /// Non-Null if expr is a call expression whose target function is intrinsic
-  ApplicationExpr * isIntrinsicCallExpr( Expression * expr );
+	/// returns the declaration of the function called by the expr (must be ApplicationExpr or UntypedExpr)
+	DeclarationWithType * getFunction( Expression * expr );
+
+	/// Non-Null if expr is a call expression whose target function is intrinsic
+	ApplicationExpr * isIntrinsicCallExpr( Expression * expr );
 
 	/// True if stmt is a call statement where the function called is intrinsic and takes one parameter.
Index: src/ResolvExpr/AlternativeFinder.cc
===================================================================
--- src/ResolvExpr/AlternativeFinder.cc	(revision e7cc8cb477d1030eb38a612a1830c48cd7085bec)
+++ src/ResolvExpr/AlternativeFinder.cc	(revision a98b2cca9704d45e2cb19838871a79c1c794fcd6)
@@ -1044,13 +1044,17 @@
 
 	void AlternativeFinder::visit( ConditionalExpr *conditionalExpr ) {
+		// find alternatives for condition
 		AlternativeFinder firstFinder( indexer, env );
 		firstFinder.findWithAdjustment( conditionalExpr->get_arg1() );
 		for ( AltList::const_iterator first = firstFinder.alternatives.begin(); first != firstFinder.alternatives.end(); ++first ) {
+			// find alternatives for true expression
 			AlternativeFinder secondFinder( indexer, first->env );
 			secondFinder.findWithAdjustment( conditionalExpr->get_arg2() );
 			for ( AltList::const_iterator second = secondFinder.alternatives.begin(); second != secondFinder.alternatives.end(); ++second ) {
+				// find alterantives for false expression
 				AlternativeFinder thirdFinder( indexer, second->env );
 				thirdFinder.findWithAdjustment( conditionalExpr->get_arg3() );
 				for ( AltList::const_iterator third = thirdFinder.alternatives.begin(); third != thirdFinder.alternatives.end(); ++third ) {
+					// unify true and false types, then infer parameters to produce new alternatives
 					OpenVarSet openVars;
 					AssertionSet needAssertions, haveAssertions;
@@ -1079,4 +1083,26 @@
 	}
 
+	void AlternativeFinder::visit( RangeExpr * rangeExpr ) {
+		// resolve low and high, accept alternatives whose low and high types unify
+		AlternativeFinder firstFinder( indexer, env );
+		firstFinder.findWithAdjustment( rangeExpr->get_low() );
+		for ( AltList::const_iterator first = firstFinder.alternatives.begin(); first != firstFinder.alternatives.end(); ++first ) {
+			AlternativeFinder secondFinder( indexer, first->env );
+			secondFinder.findWithAdjustment( rangeExpr->get_high() );
+			for ( AltList::const_iterator second = secondFinder.alternatives.begin(); second != secondFinder.alternatives.end(); ++second ) {
+				OpenVarSet openVars;
+				AssertionSet needAssertions, haveAssertions;
+				Alternative newAlt( 0, second->env, first->cost + second->cost );
+				Type* commonType = nullptr;
+				if ( unify( first->expr->get_result(), second->expr->get_result(), newAlt.env, needAssertions, haveAssertions, openVars, indexer, commonType ) ) {
+					RangeExpr *newExpr = new RangeExpr( first->expr->clone(), second->expr->clone() );
+					newExpr->set_result( commonType ? commonType : first->expr->get_result()->clone() );
+					newAlt.expr = newExpr;
+					inferParameters( needAssertions, haveAssertions, newAlt, openVars, back_inserter( alternatives ) );
+				} // if
+			} // for
+		} // for
+	}
+
 	void AlternativeFinder::visit( UntypedTupleExpr *tupleExpr ) {
 		std::list< AlternativeFinder > subExprAlternatives;
Index: src/ResolvExpr/AlternativeFinder.h
===================================================================
--- src/ResolvExpr/AlternativeFinder.h	(revision e7cc8cb477d1030eb38a612a1830c48cd7085bec)
+++ src/ResolvExpr/AlternativeFinder.h	(revision a98b2cca9704d45e2cb19838871a79c1c794fcd6)
@@ -66,4 +66,5 @@
 		virtual void visit( ImplicitCopyCtorExpr * impCpCtorExpr );
 		virtual void visit( ConstructorExpr * ctorExpr );
+		virtual void visit( RangeExpr * rangeExpr );
 		virtual void visit( UntypedTupleExpr *tupleExpr );
 		virtual void visit( TupleExpr *tupleExpr );
Index: src/ResolvExpr/Resolver.cc
===================================================================
--- src/ResolvExpr/Resolver.cc	(revision e7cc8cb477d1030eb38a612a1830c48cd7085bec)
+++ src/ResolvExpr/Resolver.cc	(revision a98b2cca9704d45e2cb19838871a79c1c794fcd6)
@@ -302,19 +302,25 @@
 	}
 
-	template< typename SwitchClass >
-	void handleSwitchStmt( SwitchClass *switchStmt, SymTab::Indexer &visitor ) {
+	void Resolver::visit( SwitchStmt *switchStmt ) {
+		ValueGuard< Type * > oldInitContext( initContext );
 		Expression *newExpr;
-		newExpr = findIntegralExpression( switchStmt->get_condition(), visitor );
+		newExpr = findIntegralExpression( switchStmt->get_condition(), *this );
 		delete switchStmt->get_condition();
 		switchStmt->set_condition( newExpr );
 
-		visitor.Visitor::visit( switchStmt );
-	}
-
-	void Resolver::visit( SwitchStmt *switchStmt ) {
-		handleSwitchStmt( switchStmt, *this );
+		initContext = newExpr->get_result();
+		Parent::visit( switchStmt );
 	}
 
 	void Resolver::visit( CaseStmt *caseStmt ) {
+		if ( caseStmt->get_condition() ) {
+			assert( initContext );
+			CastExpr * castExpr = new CastExpr( caseStmt->get_condition(), initContext->clone() );
+			Expression * newExpr = findSingleExpression( castExpr, *this );
+			castExpr = safe_dynamic_cast< CastExpr * >( newExpr );
+			caseStmt->set_condition( castExpr->get_arg() );
+			castExpr->set_arg( nullptr );
+			delete castExpr;
+		}
 		Parent::visit( caseStmt );
 	}
Index: src/Tuples/TupleExpansion.cc
===================================================================
--- src/Tuples/TupleExpansion.cc	(revision e7cc8cb477d1030eb38a612a1830c48cd7085bec)
+++ src/Tuples/TupleExpansion.cc	(revision a98b2cca9704d45e2cb19838871a79c1c794fcd6)
@@ -29,4 +29,5 @@
 #include "ResolvExpr/typeops.h"
 #include "InitTweak/GenInit.h"
+#include "InitTweak/InitTweak.h"
 
 namespace Tuples {
@@ -78,5 +79,5 @@
 			}
 		  private:
-			ScopedMap< std::string, StructDecl * > typeMap;
+			ScopedMap< int, StructDecl * > typeMap;
 		};
 
@@ -213,26 +214,25 @@
 
 	Type * TupleTypeReplacer::mutate( TupleType * tupleType ) {
-		std::string mangleName = SymTab::Mangler::mangleType( tupleType );
 		tupleType = safe_dynamic_cast< TupleType * > ( Parent::mutate( tupleType ) );
-		if ( ! typeMap.count( mangleName ) ) {
-			// generate struct type to replace tuple type
-			// xxx - should fix this to only generate one tuple struct for each number of type parameters
-			StructDecl * decl = new StructDecl( "_tuple_type_" + mangleName );
+		unsigned tupleSize = tupleType->size();
+		if ( ! typeMap.count( tupleSize ) ) {
+			// generate struct type to replace tuple type based on the number of components in the tuple
+			StructDecl * decl = new StructDecl( toString( "_tuple_type_", tupleSize  ) );
 			decl->set_body( true );
-			for ( size_t i = 0; i < tupleType->size(); ++i ) {
+			for ( size_t i = 0; i < tupleSize; ++i ) {
 				TypeDecl * tyParam = new TypeDecl( toString("tuple_param_", i), DeclarationNode::NoStorageClass, nullptr, TypeDecl::Any );
 				decl->get_members().push_back( new ObjectDecl( toString("field_", i), DeclarationNode::NoStorageClass, LinkageSpec::C, nullptr, new TypeInstType( Type::Qualifiers(), tyParam->get_name(), tyParam ), nullptr ) );
 				decl->get_parameters().push_back( tyParam );
 			}
-			if ( tupleType->size() == 0 ) {
+			if ( tupleSize == 0 ) {
 				// empty structs are not standard C. Add a dummy field to empty tuples to silence warnings when a compound literal Tuple0 is created.
 				decl->get_members().push_back( new ObjectDecl( "dummy", DeclarationNode::NoStorageClass, LinkageSpec::C, nullptr, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), nullptr ) );
 			}
-			typeMap[mangleName] = decl;
+			typeMap[tupleSize] = decl;
 			addDeclaration( decl );
 		}
 		Type::Qualifiers qualifiers = tupleType->get_qualifiers();
 
-		StructDecl * decl = typeMap[mangleName];
+		StructDecl * decl = typeMap[tupleSize];
 		StructInstType * newType = new StructInstType( qualifiers, decl );
 		for ( Type * t : *tupleType ) {
@@ -337,5 +337,16 @@
 		public:
 			typedef Visitor Parent;
-			virtual void visit( ApplicationExpr * appExpr ) { maybeImpure = true;	}
+			virtual void visit( ApplicationExpr * appExpr ) {
+				if ( DeclarationWithType * function = InitTweak::getFunction( appExpr ) ) {
+					if ( function->get_linkage() == LinkageSpec::Intrinsic ) {
+						if ( function->get_name() == "*?" || function->get_name() == "?[?]" ) {
+							// intrinsic dereference, subscript are pure, but need to recursively look for impurity
+							Parent::visit( appExpr );
+							return;
+						}
+					}
+				}
+				maybeImpure = true;
+			}
 			virtual void visit( UntypedExpr * untypedExpr ) { maybeImpure = true; }
 			bool maybeImpure = false;
Index: src/tests/.expect/32/KRfunctions.txt
===================================================================
--- src/tests/.expect/32/KRfunctions.txt	(revision a98b2cca9704d45e2cb19838871a79c1c794fcd6)
+++ src/tests/.expect/32/KRfunctions.txt	(revision a98b2cca9704d45e2cb19838871a79c1c794fcd6)
@@ -0,0 +1,93 @@
+__attribute__ ((__nothrow__,__leaf__,__malloc__)) extern void *malloc(unsigned int __size);
+__attribute__ ((__nothrow__,__leaf__)) extern void free(void *__ptr);
+__attribute__ ((__nothrow__,__leaf__,__noreturn__)) extern void abort(void);
+__attribute__ ((__nothrow__,__leaf__,__nonnull__(1))) extern int atexit(void (*__func)(void));
+__attribute__ ((__nothrow__,__leaf__,__noreturn__)) extern void exit(int __status);
+extern int printf(const char *__restrict __format, ...);
+int __f0__Fi_iPCii__1(int __a__i_1, const int *__b__PCi_1, int __c__i_1){
+    int ___retval_f0__i_1;
+}
+int __f1__Fi_PiiPi__1(int *__a__Pi_1, __attribute__ ((unused)) int __b__i_1, int *__c__Pi_1){
+    int ___retval_f1__i_1;
+}
+int __f2__Fi_iPiPi__1(int __a__i_1, int *__b__Pi_1, int *__c__Pi_1){
+    int ___retval_f2__i_1;
+}
+struct S {
+    int __i__i_1;
+};
+static inline void ___constructor__F_P2sS_autogen___1(struct S *___dst__P2sS_1);
+static inline void ___constructor__F_P2sS2sS_autogen___1(struct S *___dst__P2sS_1, struct S ___src__2sS_1);
+static inline void ___destructor__F_P2sS_autogen___1(struct S *___dst__P2sS_1);
+static inline struct S ___operator_assign__F2sS_P2sS2sS_autogen___1(struct S *___dst__P2sS_1, struct S ___src__2sS_1);
+static inline void ___constructor__F_P2sS_autogen___1(struct S *___dst__P2sS_1){
+    ((void)((*((int *)(&(*___dst__P2sS_1).__i__i_1)))) /* ?{} */);
+}
+static inline void ___constructor__F_P2sS2sS_autogen___1(struct S *___dst__P2sS_1, struct S ___src__2sS_1){
+    ((void)((*((int *)(&(*___dst__P2sS_1).__i__i_1)))=___src__2sS_1.__i__i_1) /* ?{} */);
+}
+static inline void ___destructor__F_P2sS_autogen___1(struct S *___dst__P2sS_1){
+    ((void)((*((int *)(&(*___dst__P2sS_1).__i__i_1)))) /* ^?{} */);
+}
+static inline struct S ___operator_assign__F2sS_P2sS2sS_autogen___1(struct S *___dst__P2sS_1, struct S ___src__2sS_1){
+    ((void)((*___dst__P2sS_1).__i__i_1=___src__2sS_1.__i__i_1));
+    return ((struct S )___src__2sS_1);
+}
+static inline void ___constructor__F_P2sSi_autogen___1(struct S *___dst__P2sS_1, int __i__i_1){
+    ((void)((*((int *)(&(*___dst__P2sS_1).__i__i_1)))=__i__i_1) /* ?{} */);
+}
+int __f3__Fi_2sS2sSPi__1(struct S __a__2sS_1, struct S __b__2sS_1, int *__c__Pi_1){
+    int ___retval_f3__i_1;
+    struct S __s__2sS_2;
+}
+int __f4__Fi_iPiPi__1(int __a__i_1, int *__b__Pi_1, int *__c__Pi_1){
+    int ___retval_f4__i_1;
+}
+int __f5__Fi_iPiPi__1(int __a__i_1, int *__b__Pi_1, int *__c__Pi_1){
+    int ___retval_f5__i_1;
+}
+int (*__f6__FPFi_i__iPiPi__1(int __a__i_1, int *__b__Pi_1, int *__c__Pi_1))(int ){
+    int (*___retval_f6__PFi_i__1)(int );
+}
+int (*__f7__FPFi_ii__iPiPi__1(int __a__i_1, int *__b__Pi_1, int *__c__Pi_1))(int __a__i_1, int __b__i_1){
+    int (*___retval_f7__PFi_ii__1)(int __a__i_1, int __b__i_1);
+}
+int *__f8__FPi_iPiPi__1(int __a__i_1, int *__b__Pi_1, int *__c__Pi_1){
+    int *___retval_f8__Pi_1;
+}
+int *const __f9__FCPi_PiiPi__1(int *__a__Pi_1, int __b__i_1, int *__c__Pi_1){
+    int *const ___retval_f9__CPi_1;
+}
+int *(*__f10__FPFPi_ii__iPiPid__1(int __a__i_1, int *__b__Pi_1, int *__c__Pi_1, double __y__d_1))(int __x__i_1, int __y__i_1){
+    int *(*___retval_f10__PFPi_ii__1)(int __x__i_1, int __y__i_1);
+    int *__x__FPi_ii__2(int , int );
+    ((void)(___retval_f10__PFPi_ii__1=__x__FPi_ii__2) /* ?{} */);
+    return ((int *(*)(int __x__i_1, int __y__i_1))___retval_f10__PFPi_ii__1);
+}
+int (*__f11__FPA0i_iPiPi__1(int __a__i_1, int *__b__Pi_1, int *__c__Pi_1))[]{
+    int (*___retval_f11__PA0i_1)[];
+}
+int (*__f12__FPA0A0i_iPiPi__1(int __a__i_1, int *__b__Pi_1, int *__c__Pi_1))[][((unsigned int )10)]{
+    int (*___retval_f12__PA0A0i_1)[][((unsigned int )10)];
+}
+int (*__f13__FPA0A0i_iPiPi__1(int __a__i_1, int *__b__Pi_1, int *__c__Pi_1))[][((unsigned int )10)]{
+    int (*___retval_f13__PA0A0i_1)[][((unsigned int )10)];
+}
+int (*__f14__FPA0A0i_iPiPi__1(int __a__i_1, int *__b__Pi_1, int *__c__Pi_1))[][((unsigned int )10)]{
+    int (*___retval_f14__PA0A0i_1)[][((unsigned int )10)];
+}
+const int __fred__FCi___1(){
+    const int ___retval_fred__Ci_1;
+    int *(*__x__PFPi_ii__2)(int , int );
+    int __a__i_2;
+    int __b__i_2;
+    int *(*_tmp_cp_ret0)(int __x__i_1, int __y__i_1);
+    ((void)(__x__PFPi_ii__2=((_tmp_cp_ret0=__f10__FPFPi_ii__iPiPid__1(3, (&__a__i_2), (&__b__i_2), 3.5)) , _tmp_cp_ret0)));
+    ((void)((*((int *(**)(int __x__i_1, int __y__i_1))(&_tmp_cp_ret0)))) /* ^?{} */);
+    const int __f1__FCi_iPiPi__2(int __a__i_2, int *__b__Pi_2, int *__c__Pi_2){
+        const int ___retval_f1__Ci_2;
+    }
+    const int __f2__FCi_iii__2(int __a__i_2, int __b__i_2, int __c__i_2){
+        const int ___retval_f2__Ci_2;
+    }
+}
Index: src/tests/.expect/64/KRfunctions.txt
===================================================================
--- src/tests/.expect/64/KRfunctions.txt	(revision a98b2cca9704d45e2cb19838871a79c1c794fcd6)
+++ src/tests/.expect/64/KRfunctions.txt	(revision a98b2cca9704d45e2cb19838871a79c1c794fcd6)
@@ -0,0 +1,93 @@
+__attribute__ ((__nothrow__,__leaf__,__malloc__)) extern void *malloc(long unsigned int __size);
+__attribute__ ((__nothrow__,__leaf__)) extern void free(void *__ptr);
+__attribute__ ((__nothrow__,__leaf__,__noreturn__)) extern void abort(void);
+__attribute__ ((__nothrow__,__leaf__,__nonnull__(1))) extern int atexit(void (*__func)(void));
+__attribute__ ((__nothrow__,__leaf__,__noreturn__)) extern void exit(int __status);
+extern int printf(const char *__restrict __format, ...);
+int __f0__Fi_iPCii__1(int __a__i_1, const int *__b__PCi_1, int __c__i_1){
+    int ___retval_f0__i_1;
+}
+int __f1__Fi_PiiPi__1(int *__a__Pi_1, __attribute__ ((unused)) int __b__i_1, int *__c__Pi_1){
+    int ___retval_f1__i_1;
+}
+int __f2__Fi_iPiPi__1(int __a__i_1, int *__b__Pi_1, int *__c__Pi_1){
+    int ___retval_f2__i_1;
+}
+struct S {
+    int __i__i_1;
+};
+static inline void ___constructor__F_P2sS_autogen___1(struct S *___dst__P2sS_1);
+static inline void ___constructor__F_P2sS2sS_autogen___1(struct S *___dst__P2sS_1, struct S ___src__2sS_1);
+static inline void ___destructor__F_P2sS_autogen___1(struct S *___dst__P2sS_1);
+static inline struct S ___operator_assign__F2sS_P2sS2sS_autogen___1(struct S *___dst__P2sS_1, struct S ___src__2sS_1);
+static inline void ___constructor__F_P2sS_autogen___1(struct S *___dst__P2sS_1){
+    ((void)((*((int *)(&(*___dst__P2sS_1).__i__i_1)))) /* ?{} */);
+}
+static inline void ___constructor__F_P2sS2sS_autogen___1(struct S *___dst__P2sS_1, struct S ___src__2sS_1){
+    ((void)((*((int *)(&(*___dst__P2sS_1).__i__i_1)))=___src__2sS_1.__i__i_1) /* ?{} */);
+}
+static inline void ___destructor__F_P2sS_autogen___1(struct S *___dst__P2sS_1){
+    ((void)((*((int *)(&(*___dst__P2sS_1).__i__i_1)))) /* ^?{} */);
+}
+static inline struct S ___operator_assign__F2sS_P2sS2sS_autogen___1(struct S *___dst__P2sS_1, struct S ___src__2sS_1){
+    ((void)((*___dst__P2sS_1).__i__i_1=___src__2sS_1.__i__i_1));
+    return ((struct S )___src__2sS_1);
+}
+static inline void ___constructor__F_P2sSi_autogen___1(struct S *___dst__P2sS_1, int __i__i_1){
+    ((void)((*((int *)(&(*___dst__P2sS_1).__i__i_1)))=__i__i_1) /* ?{} */);
+}
+int __f3__Fi_2sS2sSPi__1(struct S __a__2sS_1, struct S __b__2sS_1, int *__c__Pi_1){
+    int ___retval_f3__i_1;
+    struct S __s__2sS_2;
+}
+int __f4__Fi_iPiPi__1(int __a__i_1, int *__b__Pi_1, int *__c__Pi_1){
+    int ___retval_f4__i_1;
+}
+int __f5__Fi_iPiPi__1(int __a__i_1, int *__b__Pi_1, int *__c__Pi_1){
+    int ___retval_f5__i_1;
+}
+int (*__f6__FPFi_i__iPiPi__1(int __a__i_1, int *__b__Pi_1, int *__c__Pi_1))(int ){
+    int (*___retval_f6__PFi_i__1)(int );
+}
+int (*__f7__FPFi_ii__iPiPi__1(int __a__i_1, int *__b__Pi_1, int *__c__Pi_1))(int __a__i_1, int __b__i_1){
+    int (*___retval_f7__PFi_ii__1)(int __a__i_1, int __b__i_1);
+}
+int *__f8__FPi_iPiPi__1(int __a__i_1, int *__b__Pi_1, int *__c__Pi_1){
+    int *___retval_f8__Pi_1;
+}
+int *const __f9__FCPi_PiiPi__1(int *__a__Pi_1, int __b__i_1, int *__c__Pi_1){
+    int *const ___retval_f9__CPi_1;
+}
+int *(*__f10__FPFPi_ii__iPiPid__1(int __a__i_1, int *__b__Pi_1, int *__c__Pi_1, double __y__d_1))(int __x__i_1, int __y__i_1){
+    int *(*___retval_f10__PFPi_ii__1)(int __x__i_1, int __y__i_1);
+    int *__x__FPi_ii__2(int , int );
+    ((void)(___retval_f10__PFPi_ii__1=__x__FPi_ii__2) /* ?{} */);
+    return ((int *(*)(int __x__i_1, int __y__i_1))___retval_f10__PFPi_ii__1);
+}
+int (*__f11__FPA0i_iPiPi__1(int __a__i_1, int *__b__Pi_1, int *__c__Pi_1))[]{
+    int (*___retval_f11__PA0i_1)[];
+}
+int (*__f12__FPA0A0i_iPiPi__1(int __a__i_1, int *__b__Pi_1, int *__c__Pi_1))[][((long unsigned int )10)]{
+    int (*___retval_f12__PA0A0i_1)[][((long unsigned int )10)];
+}
+int (*__f13__FPA0A0i_iPiPi__1(int __a__i_1, int *__b__Pi_1, int *__c__Pi_1))[][((long unsigned int )10)]{
+    int (*___retval_f13__PA0A0i_1)[][((long unsigned int )10)];
+}
+int (*__f14__FPA0A0i_iPiPi__1(int __a__i_1, int *__b__Pi_1, int *__c__Pi_1))[][((long unsigned int )10)]{
+    int (*___retval_f14__PA0A0i_1)[][((long unsigned int )10)];
+}
+const int __fred__FCi___1(){
+    const int ___retval_fred__Ci_1;
+    int *(*__x__PFPi_ii__2)(int , int );
+    int __a__i_2;
+    int __b__i_2;
+    int *(*_tmp_cp_ret0)(int __x__i_1, int __y__i_1);
+    ((void)(__x__PFPi_ii__2=((_tmp_cp_ret0=__f10__FPFPi_ii__iPiPid__1(3, (&__a__i_2), (&__b__i_2), 3.5)) , _tmp_cp_ret0)));
+    ((void)((*((int *(**)(int __x__i_1, int __y__i_1))(&_tmp_cp_ret0)))) /* ^?{} */);
+    const int __f1__FCi_iPiPi__2(int __a__i_2, int *__b__Pi_2, int *__c__Pi_2){
+        const int ___retval_f1__Ci_2;
+    }
+    const int __f2__FCi_iii__2(int __a__i_2, int __b__i_2, int __c__i_2){
+        const int ___retval_f2__Ci_2;
+    }
+}
Index: src/tests/.expect/KRfunctions.txt
===================================================================
--- src/tests/.expect/KRfunctions.txt	(revision e7cc8cb477d1030eb38a612a1830c48cd7085bec)
+++ 	(revision )
@@ -1,93 +1,0 @@
-__attribute__ ((__nothrow__,__leaf__,__malloc__)) extern void *malloc(long unsigned int __size);
-__attribute__ ((__nothrow__,__leaf__)) extern void free(void *__ptr);
-__attribute__ ((__nothrow__,__leaf__,__noreturn__)) extern void abort(void);
-__attribute__ ((__nothrow__,__leaf__,__nonnull__(1))) extern int atexit(void (*__func)(void));
-__attribute__ ((__nothrow__,__leaf__,__noreturn__)) extern void exit(int __status);
-extern int printf(const char *__restrict __format, ...);
-int __f0__Fi_iPCii__1(int __a__i_1, const int *__b__PCi_1, int __c__i_1){
-    int ___retval_f0__i_1;
-}
-int __f1__Fi_PiiPi__1(int *__a__Pi_1, __attribute__ ((unused)) int __b__i_1, int *__c__Pi_1){
-    int ___retval_f1__i_1;
-}
-int __f2__Fi_iPiPi__1(int __a__i_1, int *__b__Pi_1, int *__c__Pi_1){
-    int ___retval_f2__i_1;
-}
-struct S {
-    int __i__i_1;
-};
-static inline void ___constructor__F_P2sS_autogen___1(struct S *___dst__P2sS_1);
-static inline void ___constructor__F_P2sS2sS_autogen___1(struct S *___dst__P2sS_1, struct S ___src__2sS_1);
-static inline void ___destructor__F_P2sS_autogen___1(struct S *___dst__P2sS_1);
-static inline struct S ___operator_assign__F2sS_P2sS2sS_autogen___1(struct S *___dst__P2sS_1, struct S ___src__2sS_1);
-static inline void ___constructor__F_P2sS_autogen___1(struct S *___dst__P2sS_1){
-    ((void)((*((int *)(&(*___dst__P2sS_1).__i__i_1)))) /* ?{} */);
-}
-static inline void ___constructor__F_P2sS2sS_autogen___1(struct S *___dst__P2sS_1, struct S ___src__2sS_1){
-    ((void)((*((int *)(&(*___dst__P2sS_1).__i__i_1)))=___src__2sS_1.__i__i_1) /* ?{} */);
-}
-static inline void ___destructor__F_P2sS_autogen___1(struct S *___dst__P2sS_1){
-    ((void)((*((int *)(&(*___dst__P2sS_1).__i__i_1)))) /* ^?{} */);
-}
-static inline struct S ___operator_assign__F2sS_P2sS2sS_autogen___1(struct S *___dst__P2sS_1, struct S ___src__2sS_1){
-    ((void)((*___dst__P2sS_1).__i__i_1=___src__2sS_1.__i__i_1));
-    return ((struct S )___src__2sS_1);
-}
-static inline void ___constructor__F_P2sSi_autogen___1(struct S *___dst__P2sS_1, int __i__i_1){
-    ((void)((*((int *)(&(*___dst__P2sS_1).__i__i_1)))=__i__i_1) /* ?{} */);
-}
-int __f3__Fi_2sS2sSPi__1(struct S __a__2sS_1, struct S __b__2sS_1, int *__c__Pi_1){
-    int ___retval_f3__i_1;
-    struct S __s__2sS_2;
-}
-int __f4__Fi_iPiPi__1(int __a__i_1, int *__b__Pi_1, int *__c__Pi_1){
-    int ___retval_f4__i_1;
-}
-int __f5__Fi_iPiPi__1(int __a__i_1, int *__b__Pi_1, int *__c__Pi_1){
-    int ___retval_f5__i_1;
-}
-int (*__f6__FPFi_i__iPiPi__1(int __a__i_1, int *__b__Pi_1, int *__c__Pi_1))(int ){
-    int (*___retval_f6__PFi_i__1)(int );
-}
-int (*__f7__FPFi_ii__iPiPi__1(int __a__i_1, int *__b__Pi_1, int *__c__Pi_1))(int __a__i_1, int __b__i_1){
-    int (*___retval_f7__PFi_ii__1)(int __a__i_1, int __b__i_1);
-}
-int *__f8__FPi_iPiPi__1(int __a__i_1, int *__b__Pi_1, int *__c__Pi_1){
-    int *___retval_f8__Pi_1;
-}
-int *const __f9__FCPi_PiiPi__1(int *__a__Pi_1, int __b__i_1, int *__c__Pi_1){
-    int *const ___retval_f9__CPi_1;
-}
-int *(*__f10__FPFPi_ii__iPiPid__1(int __a__i_1, int *__b__Pi_1, int *__c__Pi_1, double __y__d_1))(int __x__i_1, int __y__i_1){
-    int *(*___retval_f10__PFPi_ii__1)(int __x__i_1, int __y__i_1);
-    int *__x__FPi_ii__2(int , int );
-    ((void)(___retval_f10__PFPi_ii__1=__x__FPi_ii__2) /* ?{} */);
-    return ((int *(*)(int __x__i_1, int __y__i_1))___retval_f10__PFPi_ii__1);
-}
-int (*__f11__FPA0i_iPiPi__1(int __a__i_1, int *__b__Pi_1, int *__c__Pi_1))[]{
-    int (*___retval_f11__PA0i_1)[];
-}
-int (*__f12__FPA0A0i_iPiPi__1(int __a__i_1, int *__b__Pi_1, int *__c__Pi_1))[][((long unsigned int )10)]{
-    int (*___retval_f12__PA0A0i_1)[][((long unsigned int )10)];
-}
-int (*__f13__FPA0A0i_iPiPi__1(int __a__i_1, int *__b__Pi_1, int *__c__Pi_1))[][((long unsigned int )10)]{
-    int (*___retval_f13__PA0A0i_1)[][((long unsigned int )10)];
-}
-int (*__f14__FPA0A0i_iPiPi__1(int __a__i_1, int *__b__Pi_1, int *__c__Pi_1))[][((long unsigned int )10)]{
-    int (*___retval_f14__PA0A0i_1)[][((long unsigned int )10)];
-}
-const int __fred__FCi___1(){
-    const int ___retval_fred__Ci_1;
-    int *(*__x__PFPi_ii__2)(int , int );
-    int __a__i_2;
-    int __b__i_2;
-    int *(*_tmp_cp_ret0)(int __x__i_1, int __y__i_1);
-    ((void)(__x__PFPi_ii__2=((_tmp_cp_ret0=__f10__FPFPi_ii__iPiPid__1(3, (&__a__i_2), (&__b__i_2), 3.5)) , _tmp_cp_ret0)));
-    ((void)((*((int *(**)(int __x__i_1, int __y__i_1))(&_tmp_cp_ret0)))) /* ^?{} */);
-    const int __f1__FCi_iPiPi__2(int __a__i_2, int *__b__Pi_2, int *__c__Pi_2){
-        const int ___retval_f1__Ci_2;
-    }
-    const int __f2__FCi_iii__2(int __a__i_2, int __b__i_2, int __c__i_2){
-        const int ___retval_f2__Ci_2;
-    }
-}
Index: src/tests/dtor-early-exit.c
===================================================================
--- src/tests/dtor-early-exit.c	(revision e7cc8cb477d1030eb38a612a1830c48cd7085bec)
+++ src/tests/dtor-early-exit.c	(revision a98b2cca9704d45e2cb19838871a79c1c794fcd6)
@@ -1,10 +1,10 @@
-// 
+//
 // 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 -- 
-// 
+//
+// dtor-early-exit.c --
+//
 // Author           : Rob Schluntz
 // Created On       : Wed Aug 17 08:26:25 2016
@@ -12,5 +12,5 @@
 // Last Modified On : Wed Aug 17 08:29:37 2016
 // Update Count     : 2
-// 
+//
 
 #include <fstream>
@@ -213,6 +213,6 @@
 		// S_G-S_L = {}
 	}
+#ifdef ERR2
 	// S_G = {}
-#ifdef ERR2
 	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
