Index: src/GenPoly/Box.cpp
===================================================================
--- src/GenPoly/Box.cpp	(revision d63746fce4dcbd1594574965079adbb4e1f8cdc5)
+++ src/GenPoly/Box.cpp	(revision a22d14894da94bbedce7033774ba9641ab4c1b5a)
@@ -366,6 +366,7 @@
 
 	/// Passes extra layout arguments for sized polymorphic type parameters.
-	ast::vector<ast::Expr>::iterator passTypeVars(
+	void passTypeVars(
 		ast::ApplicationExpr * expr,
+		ast::vector<ast::Expr> & extraArgs,
 		ast::FunctionType const * funcType );
 	/// Wraps a function application with a new temporary for the
@@ -387,6 +388,6 @@
 	/// parameter list. arg should point into expr's argument list.
 	void boxParams(
-		ast::ApplicationExpr const * expr,
-		ast::vector<ast::Expr>::iterator arg,
+		ast::ApplicationExpr * expr,
+		ast::Type const * polyRetType,
 		ast::FunctionType const * function,
 		const TypeVarMap & typeVars );
@@ -395,5 +396,5 @@
 	void addInferredParams(
 		ast::ApplicationExpr * expr,
-		ast::vector<ast::Expr>::iterator arg,
+		ast::vector<ast::Expr> & extraArgs,
 		ast::FunctionType const * functionType,
 		const TypeVarMap & typeVars );
@@ -636,8 +637,4 @@
 	ast::Expr const * ret = expr;
 
-	// TODO: This entire section should probably be refactored to do less
-	// pushing to the front/middle of a vector.
-	ptrdiff_t initArgCount = mutExpr->args.size();
-
 	TypeVarMap exprTypeVars;
 	makeTypeVarMap( function, exprTypeVars );
@@ -662,13 +659,10 @@
 	}
 
-	assert( typeSubs );
-	ast::vector<ast::Expr>::iterator argIt =
-		passTypeVars( mutExpr, function );
-	addInferredParams( mutExpr, argIt, function, exprTypeVars );
-
-	argIt = mutExpr->args.begin();
-	std::advance( argIt, ( mutExpr->args.size() - initArgCount ) );
-
-	boxParams( mutExpr, argIt, function, exprTypeVars );
+	ast::vector<ast::Expr> prependArgs;
+	passTypeVars( mutExpr, prependArgs, function );
+	addInferredParams( mutExpr, prependArgs, function, exprTypeVars );
+
+	boxParams( mutExpr, dynRetType, function, exprTypeVars );
+	spliceBegin( mutExpr->args, prependArgs );
 	passAdapters( mutExpr, function, exprTypeVars );
 
@@ -766,9 +760,9 @@
 }
 
-ast::vector<ast::Expr>::iterator CallAdapter::passTypeVars(
+void CallAdapter::passTypeVars(
 		ast::ApplicationExpr * expr,
+		ast::vector<ast::Expr> & extraArgs,
 		ast::FunctionType const * function ) {
 	assert( typeSubs );
-	ast::vector<ast::Expr>::iterator arg = expr->args.begin();
 	// Pass size/align for type variables.
 	for ( ast::ptr<ast::TypeInstType> const & typeVar : function->forall ) {
@@ -780,12 +774,9 @@
 						   toString( typeSubs ).c_str(), typeVar->typeString().c_str() );
 		}
-		arg = expr->args.insert( arg,
+		extraArgs.emplace_back(
 			new ast::SizeofExpr( expr->location, ast::deepCopy( concrete ) ) );
-		arg++;
-		arg = expr->args.insert( arg,
+		extraArgs.emplace_back(
 			new ast::AlignofExpr( expr->location, ast::deepCopy( concrete ) ) );
-		arg++;
-	}
-	return arg;
+	}
 }
 
@@ -913,8 +904,12 @@
 
 void CallAdapter::boxParams(
-		ast::ApplicationExpr const * expr,
-		ast::vector<ast::Expr>::iterator arg,
+		ast::ApplicationExpr * expr,
+		ast::Type const * polyRetType,
 		ast::FunctionType const * function,
 		const TypeVarMap & typeVars ) {
+	// Start at the beginning, but the return argument may have been added.
+	auto arg = expr->args.begin();
+	if ( polyRetType ) ++arg;
+
 	for ( auto param : function->params ) {
 		assertf( arg != expr->args.end(),
@@ -928,8 +923,7 @@
 void CallAdapter::addInferredParams(
 		ast::ApplicationExpr * expr,
-		ast::vector<ast::Expr>::iterator arg,
+		ast::vector<ast::Expr> & extraArgs,
 		ast::FunctionType const * functionType,
 		TypeVarMap const & typeVars ) {
-	ast::vector<ast::Expr>::iterator cur = arg;
 	for ( auto assertion : functionType->assertions ) {
 		auto inferParam = expr->inferred.inferParams().find(
@@ -940,6 +934,5 @@
 		ast::ptr<ast::Expr> newExpr = ast::deepCopy( inferParam->second.expr );
 		boxParam( newExpr, assertion->result, typeVars );
-		cur = expr->args.insert( cur, newExpr.release() );
-		++cur;
+		extraArgs.emplace_back( newExpr.release() );
 	}
 }
Index: src/main.cc
===================================================================
--- src/main.cc	(revision d63746fce4dcbd1594574965079adbb4e1f8cdc5)
+++ src/main.cc	(revision a22d14894da94bbedce7033774ba9641ab4c1b5a)
@@ -181,4 +181,5 @@
 
 static void _Signal(struct sigaction & act, int sig, int flags ) {
+	sigemptyset( &act.sa_mask );
 	act.sa_flags = flags;
 
