Index: src/GenPoly/Box.cc
===================================================================
--- src/GenPoly/Box.cc	(revision 5fda7143cbcbc2c8f66e8862aecc99dfa3619c54)
+++ src/GenPoly/Box.cc	(revision 4ab95362ad50a8877c73267b3b411c0bf7ba8f3e)
@@ -782,6 +782,6 @@
 
 			// add size/align for generic types to parameter list
-			if ( appExpr->get_function()->get_results().empty() ) return;
-			FunctionType *funcType = getFunctionType( appExpr->get_function()->get_results().front() );
+			if ( ! appExpr->get_function()->has_result() ) return;
+			FunctionType *funcType = getFunctionType( appExpr->get_function()->get_result() );
 			assert( funcType );
 
@@ -799,6 +799,6 @@
 			for ( ; fnParm != funcType->get_parameters().end() && fnArg != appExpr->get_args().end(); ++fnParm, ++fnArg ) {
 				VariableExpr *fnArgBase = getBaseVar( *fnArg );
-				if ( ! fnArgBase || fnArgBase->get_results().empty() ) continue;
-				passArgTypeVars( appExpr, (*fnParm)->get_type(), fnArgBase->get_results().front(), arg, exprTyVars, seenTypes );
+				if ( ! fnArgBase ) continue; // xxx - previously had check for non-empty fnArgBase results
+				passArgTypeVars( appExpr, (*fnParm)->get_type(), fnArgBase->get_result(), arg, exprTyVars, seenTypes );
 			}
 		}
@@ -890,5 +890,5 @@
 			Type * adapteeType = new PointerType( Type::Qualifiers(), new FunctionType( Type::Qualifiers(), true ) );
 			appExpr->get_args().push_front( new CastExpr( appExpr->get_function(), adapteeType ) );
-			appExpr->set_function( new NameExpr( adapterName ) );
+			appExpr->set_function( new NameExpr( adapterName ) ); // xxx - result is never set on NameExpr
 
 			return ret;
@@ -896,10 +896,10 @@
 
 		void Pass1::boxParam( Type *param, Expression *&arg, const TyVarMap &exprTyVars ) {
-			assert( ! arg->get_results().empty() );
+			assert( arg->has_result() );
 			if ( isPolyType( param, exprTyVars ) ) {
-				if ( isPolyType( arg->get_results().front() ) ) {
+				if ( isPolyType( arg->get_result() ) ) {
 					// if the argument's type is polymorphic, we don't need to box again!
 					return;
-				} else if ( arg->get_results().front()->get_isLvalue() ) {
+				} else if ( arg->get_result()->get_isLvalue() ) {
 					// VariableExpr and MemberExpr are lvalues; need to check this isn't coming from the second arg of a comma expression though (not an lvalue)
 					// xxx - need to test that this code is still reachable
@@ -987,5 +987,5 @@
 					UntypedExpr *deref = new UntypedExpr( new NameExpr( "*?" ) );
 					deref->get_args().push_back( new CastExpr( new VariableExpr( param ), new PointerType( Type::Qualifiers(), arg->get_type()->clone() ) ) );
-					deref->get_results().push_back( arg->get_type()->clone() );
+					deref->set_result( arg->get_type()->clone() );
 					return deref;
 				} // if
@@ -1124,5 +1124,5 @@
 			} // if
 			addAssign->get_args().push_back( new NameExpr( sizeofName( mangleType( polyType ) ) ) );
-			addAssign->get_results().front() = appExpr->get_results().front()->clone();
+			addAssign->set_result( appExpr->get_result()->clone() );
 			if ( appExpr->get_env() ) {
 				addAssign->set_env( appExpr->get_env() );
@@ -1138,8 +1138,8 @@
 				if ( varExpr->get_var()->get_linkage() == LinkageSpec::Intrinsic ) {
 					if ( varExpr->get_var()->get_name() == "?[?]" ) {
-						assert( ! appExpr->get_results().empty() );
+						assert( appExpr->has_result() );
 						assert( appExpr->get_args().size() == 2 );
-						Type *baseType1 = isPolyPtr( appExpr->get_args().front()->get_results().front(), scopeTyVars, env );
-						Type *baseType2 = isPolyPtr( appExpr->get_args().back()->get_results().front(), scopeTyVars, env );
+						Type *baseType1 = isPolyPtr( appExpr->get_args().front()->get_result(), scopeTyVars, env );
+						Type *baseType2 = isPolyPtr( appExpr->get_args().back()->get_result(), scopeTyVars, env );
 						assert( ! baseType1 || ! baseType2 ); // the arguments cannot both be polymorphic pointers
 						UntypedExpr *ret = 0;
@@ -1161,5 +1161,5 @@
 						} // if
 						if ( baseType1 || baseType2 ) {
-							ret->get_results().push_front( appExpr->get_results().front()->clone() );
+							ret->set_result( appExpr->get_result()->clone() );
 							if ( appExpr->get_env() ) {
 								ret->set_env( appExpr->get_env() );
@@ -1171,10 +1171,10 @@
 						} // if
 					} else if ( varExpr->get_var()->get_name() == "*?" ) {
-						assert( ! appExpr->get_results().empty() );
+						assert( appExpr->has_result() );
 						assert( ! appExpr->get_args().empty() );
-						if ( isPolyType( appExpr->get_results().front(), scopeTyVars, env ) ) {
+						if ( isPolyType( appExpr->get_result(), scopeTyVars, env ) ) {
 							Expression *ret = appExpr->get_args().front();
-							delete ret->get_results().front();
-							ret->get_results().front() = appExpr->get_results().front()->clone();
+							delete ret->get_result();
+							ret->set_result( appExpr->get_result()->clone() );
 							if ( appExpr->get_env() ) {
 								ret->set_env( appExpr->get_env() );
@@ -1186,8 +1186,8 @@
 						} // if
 					} else if ( varExpr->get_var()->get_name() == "?++" || varExpr->get_var()->get_name() == "?--" ) {
-						assert( ! appExpr->get_results().empty() );
+						assert( appExpr->has_result() );
 						assert( appExpr->get_args().size() == 1 );
-						if ( Type *baseType = isPolyPtr( appExpr->get_results().front(), scopeTyVars, env ) ) {
-							Type *tempType = appExpr->get_results().front()->clone();
+						if ( Type *baseType = isPolyPtr( appExpr->get_result(), scopeTyVars, env ) ) {
+							Type *tempType = appExpr->get_result()->clone();
 							if ( env ) {
 								env->apply( tempType );
@@ -1206,19 +1206,19 @@
 						} // if
 					} else if ( varExpr->get_var()->get_name() == "++?" || varExpr->get_var()->get_name() == "--?" ) {
-						assert( ! appExpr->get_results().empty() );
+						assert( appExpr->has_result() );
 						assert( appExpr->get_args().size() == 1 );
-						if ( Type *baseType = isPolyPtr( appExpr->get_results().front(), scopeTyVars, env ) ) {
+						if ( Type *baseType = isPolyPtr( appExpr->get_result(), scopeTyVars, env ) ) {
 							return makeIncrDecrExpr( appExpr, baseType, varExpr->get_var()->get_name() == "++?" );
 						} // if
 					} else if ( varExpr->get_var()->get_name() == "?+?" || varExpr->get_var()->get_name() == "?-?" ) {
-						assert( ! appExpr->get_results().empty() );
+						assert( appExpr->has_result() );
 						assert( appExpr->get_args().size() == 2 );
-						Type *baseType1 = isPolyPtr( appExpr->get_args().front()->get_results().front(), scopeTyVars, env );
-						Type *baseType2 = isPolyPtr( appExpr->get_args().back()->get_results().front(), scopeTyVars, env );
+						Type *baseType1 = isPolyPtr( appExpr->get_args().front()->get_result(), scopeTyVars, env );
+						Type *baseType2 = isPolyPtr( appExpr->get_args().back()->get_result(), scopeTyVars, env );
 						if ( baseType1 && baseType2 ) {
 							UntypedExpr *divide = new UntypedExpr( new NameExpr( "?/?" ) );
 							divide->get_args().push_back( appExpr );
 							divide->get_args().push_back( new SizeofExpr( baseType1->clone() ) );
-							divide->get_results().push_front( appExpr->get_results().front()->clone() );
+							divide->set_result( appExpr->get_result()->clone() );
 							if ( appExpr->get_env() ) {
 								divide->set_env( appExpr->get_env() );
@@ -1238,7 +1238,7 @@
 						} // if
 					} else if ( varExpr->get_var()->get_name() == "?+=?" || varExpr->get_var()->get_name() == "?-=?" ) {
-						assert( ! appExpr->get_results().empty() );
+						assert( appExpr->has_result() );
 						assert( appExpr->get_args().size() == 2 );
-						Type *baseType = isPolyPtr( appExpr->get_results().front(), scopeTyVars, env );
+						Type *baseType = isPolyPtr( appExpr->get_result(), scopeTyVars, env );
 						if ( baseType ) {
 							UntypedExpr *multiply = new UntypedExpr( new NameExpr( "?*?" ) );
@@ -1266,9 +1266,7 @@
 			useRetval = oldUseRetval;
 
-			assert( ! appExpr->get_function()->get_results().empty() );
-			PointerType *pointer = dynamic_cast< PointerType *>( appExpr->get_function()->get_results().front() );
-			assert( pointer );
-			FunctionType *function = dynamic_cast< FunctionType *>( pointer->get_base() );
-			assert( function );
+			assert( appExpr->get_function()->has_result() );
+			PointerType *pointer = safe_dynamic_cast< PointerType *>( appExpr->get_function()->get_result() );
+			FunctionType *function = safe_dynamic_cast< FunctionType *>( pointer->get_base() );
 
 			if ( Expression *newExpr = handleIntrinsics( appExpr ) ) {
@@ -1308,5 +1306,5 @@
 
 		Expression *Pass1::mutate( UntypedExpr *expr ) {
-			if ( ! expr->get_results().empty() && isPolyType( expr->get_results().front(), scopeTyVars, env ) ) {
+			if ( expr->has_result() && isPolyType( expr->get_result(), scopeTyVars, env ) ) {
 				if ( NameExpr *name = dynamic_cast< NameExpr *>( expr->get_function() ) ) {
 					if ( name->get_name() == "*?" ) {
@@ -1322,17 +1320,15 @@
 
 		Expression *Pass1::mutate( AddressExpr *addrExpr ) {
-			assert( ! addrExpr->get_arg()->get_results().empty() );
+			assert( addrExpr->get_arg()->has_result() && ! addrExpr->get_arg()->get_result()->isVoid() );
 
 			bool needs = false;
 			if ( UntypedExpr *expr = dynamic_cast< UntypedExpr *>( addrExpr->get_arg() ) ) {
-				if ( ! expr->get_results().empty() && isPolyType( expr->get_results().front(), scopeTyVars, env ) ) {
+				if ( expr->has_result() && isPolyType( expr->get_result(), scopeTyVars, env ) ) {
 					if ( NameExpr *name = dynamic_cast< NameExpr *>( expr->get_function() ) ) {
 						if ( name->get_name() == "*?" ) {
 							if ( ApplicationExpr * appExpr = dynamic_cast< ApplicationExpr * >( expr->get_args().front() ) ) {
-								assert( ! appExpr->get_function()->get_results().empty() );
-								PointerType *pointer = dynamic_cast< PointerType *>( appExpr->get_function()->get_results().front() );
-								assert( pointer );
-								FunctionType *function = dynamic_cast< FunctionType *>( pointer->get_base() );
-								assert( function );
+								assert( appExpr->get_function()->has_result() );
+								PointerType *pointer = safe_dynamic_cast< PointerType *>( appExpr->get_function()->get_result() );
+								FunctionType *function = safe_dynamic_cast< FunctionType *>( pointer->get_base() );
 								needs = needsAdapter( function, scopeTyVars );
 							} // if
@@ -1343,10 +1339,10 @@
 			// isPolyType check needs to happen before mutating addrExpr arg, so pull it forward
 			// out of the if condition.
-			bool polytype = isPolyType( addrExpr->get_arg()->get_results().front(), scopeTyVars, env );
+			bool polytype = isPolyType( addrExpr->get_arg()->get_result(), scopeTyVars, env );
 			addrExpr->set_arg( mutateExpression( addrExpr->get_arg() ) );
 			if ( polytype || needs ) {
 				Expression *ret = addrExpr->get_arg();
-				delete ret->get_results().front();
-				ret->get_results().front() = addrExpr->get_results().front()->clone();
+				delete ret->get_result();
+				ret->set_result( addrExpr->get_result()->clone() );
 				addrExpr->set_arg( 0 );
 				delete addrExpr;
@@ -1386,5 +1382,5 @@
 		Statement * Pass1::mutate( ReturnStmt *returnStmt ) {
 			if ( retval && returnStmt->get_expr() ) {
-				assert( ! returnStmt->get_expr()->get_results().empty() );
+				assert( returnStmt->get_expr()->has_result() && ! returnStmt->get_expr()->get_result()->isVoid() );
 				// ***** Code Removal ***** After introducing a temporary variable for all return expressions, the following code appears superfluous.
 				// if ( returnStmt->get_expr()->get_results().front()->get_isLvalue() ) {
@@ -1466,5 +1462,5 @@
 				// replace return statement with appropriate assignment to out parameter
 				Expression *retParm = new NameExpr( retval->get_name() );
-				retParm->get_results().push_back( new PointerType( Type::Qualifiers(), retval->get_type()->clone() ) );
+				retParm->set_result( new PointerType( Type::Qualifiers(), retval->get_type()->clone() ) );
 				assignExpr->get_args().push_back( retParm );
 				assignExpr->get_args().push_back( returnStmt->get_expr() );
Index: src/GenPoly/Lvalue.cc
===================================================================
--- src/GenPoly/Lvalue.cc	(revision 5fda7143cbcbc2c8f66e8862aecc99dfa3619c54)
+++ src/GenPoly/Lvalue.cc	(revision 4ab95362ad50a8877c73267b3b411c0bf7ba8f3e)
@@ -5,5 +5,5 @@
 // file "LICENCE" distributed with Cforall.
 //
-// Lvalue.cc -- 
+// Lvalue.cc --
 //
 // Author           : Richard C. Bilson
@@ -41,5 +41,5 @@
 		  public:
 			Pass1();
-  
+
 			virtual Expression *mutate( ApplicationExpr *appExpr );
 			virtual Statement *mutate( ReturnStmt *appExpr );
@@ -99,16 +99,12 @@
 			appExpr->get_function()->acceptMutator( *this );
 			mutateAll( appExpr->get_args(), *this );
-  
-			assert( ! appExpr->get_function()->get_results().empty() );
 
-			PointerType *pointer = dynamic_cast< PointerType* >( appExpr->get_function()->get_results().front() );
-			assert( pointer );
-			FunctionType *function = dynamic_cast< FunctionType* >( pointer->get_base() );
-			assert( function );
+			PointerType *pointer = safe_dynamic_cast< PointerType* >( appExpr->get_function()->get_result() );
+			FunctionType *function = safe_dynamic_cast< FunctionType* >( pointer->get_base() );
 
 			Type *funType = isLvalueRet( function );
 			if ( funType && ! isIntrinsicApp( appExpr ) ) {
 				Expression *expr = appExpr;
-				Type *appType = appExpr->get_results().front();
+				Type *appType = appExpr->get_result();
 				if ( isPolyType( funType ) && ! isPolyType( appType ) ) {
 					// make sure cast for polymorphic type is inside dereference
@@ -116,6 +112,6 @@
 				}
 				UntypedExpr *deref = new UntypedExpr( new NameExpr( "*?" ) );
-				deref->get_results().push_back( appType->clone() );
-				appExpr->get_results().front() = new PointerType( Type::Qualifiers(), appType );
+				deref->set_result( appType->clone() );
+				appExpr->set_result( new PointerType( Type::Qualifiers(), appType ) );
 				deref->get_args().push_back( expr );
 				return deref;
@@ -127,6 +123,5 @@
 		Statement * Pass1::mutate(ReturnStmt *retStmt) {
 			if ( retval && retStmt->get_expr() ) {
-				assert( ! retStmt->get_expr()->get_results().empty() );
-				if ( retStmt->get_expr()->get_results().front()->get_isLvalue() ) {
+				if ( retStmt->get_expr()->get_result()->get_isLvalue() ) {
 					// ***** Code Removal ***** because casts may be stripped already
 
@@ -155,5 +150,5 @@
 				retParm->set_type( new PointerType( Type::Qualifiers(), retParm->get_type() ) );
 			} // if
-  
+
 			Visitor::visit( funType );
 		}
Index: src/GenPoly/Specialize.cc
===================================================================
--- src/GenPoly/Specialize.cc	(revision 5fda7143cbcbc2c8f66e8862aecc99dfa3619c54)
+++ src/GenPoly/Specialize.cc	(revision 4ab95362ad50a8877c73267b3b411c0bf7ba8f3e)
@@ -147,6 +147,6 @@
 
 	Expression * Specialize::doSpecialization( Type *formalType, Expression *actual, InferredParams *inferParams ) {
-		assert( ! actual->get_results().empty() ); // using front, should have this assert
-		if ( needsSpecialization( formalType, actual->get_results().front(), env ) ) {
+		assert( actual->has_result() );
+		if ( needsSpecialization( formalType, actual->get_result(), env ) ) {
 			FunctionType *funType;
 			if ( ( funType = getFunctionType( formalType ) ) ) {
@@ -171,6 +171,6 @@
 	void Specialize::handleExplicitParams( ApplicationExpr *appExpr ) {
 		// create thunks for the explicit parameters
-		assert( ! appExpr->get_function()->get_results().empty() );
-		FunctionType *function = getFunctionType( appExpr->get_function()->get_results().front() );
+		assert( appExpr->get_function()->has_result() );
+		FunctionType *function = getFunctionType( appExpr->get_function()->get_result() );
 		assert( function );
 		std::list< DeclarationWithType* >::iterator formal;
@@ -200,6 +200,6 @@
 	Expression * Specialize::mutate( AddressExpr *addrExpr ) {
 		addrExpr->get_arg()->acceptMutator( *this );
-		assert( ! addrExpr->get_results().empty() );
-		addrExpr->set_arg( doSpecialization( addrExpr->get_results().front(), addrExpr->get_arg() ) );
+		assert( addrExpr->has_result() );
+		addrExpr->set_arg( doSpecialization( addrExpr->get_result(), addrExpr->get_arg() ) );
 		return addrExpr;
 	}
@@ -207,9 +207,9 @@
 	Expression * Specialize::mutate( CastExpr *castExpr ) {
 		castExpr->get_arg()->acceptMutator( *this );
-		if ( castExpr->get_results().empty() ) {
+		if ( castExpr->get_result()->isVoid() ) {
 			// can't specialize if we don't have a return value
 			return castExpr;
 		}
-		Expression *specialized = doSpecialization( castExpr->get_results().front(), castExpr->get_arg() );
+		Expression *specialized = doSpecialization( castExpr->get_result(), castExpr->get_arg() );
 		if ( specialized != castExpr->get_arg() ) {
 			// assume here that the specialization incorporates the cast
