Index: src/ResolvExpr/AlternativeFinder.cc
===================================================================
--- src/ResolvExpr/AlternativeFinder.cc	(revision 2a4b0884c14643e09650daaeb3a6667b5bff6b48)
+++ src/ResolvExpr/AlternativeFinder.cc	(revision 6ed1d4b52317879c3ddb7e2d57c79ba619eed0c2)
@@ -5,11 +5,11 @@
 // file "LICENCE" distributed with Cforall.
 //
-// AlternativeFinder.cc -- 
+// AlternativeFinder.cc --
 //
 // Author           : Richard C. Bilson
 // Created On       : Sat May 16 23:52:08 2015
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Fri Jul  3 17:58:39 2015
-// Update Count     : 22
+// Last Modified By : Rob Schluntz
+// Last Modified On : Wed Feb 10 17:00:04 2016
+// Update Count     : 24
 //
 
@@ -41,5 +41,5 @@
 
 extern bool resolvep;
-#define PRINT( text ) if ( resolvep ) { text } 
+#define PRINT( text ) if ( resolvep ) { text }
 //#define DEBUG_COST
 
@@ -107,10 +107,10 @@
 					if ( candidate->cost < mapPlace->second.candidate->cost ) {
 						PRINT(
-							std::cout << "cost " << candidate->cost << " beats " << mapPlace->second.candidate->cost << std::endl;
+							std::cerr << "cost " << candidate->cost << " beats " << mapPlace->second.candidate->cost << std::endl;
 						)
 						selected[ mangleName ] = current;
 					} else if ( candidate->cost == mapPlace->second.candidate->cost ) {
 						PRINT(
-							std::cout << "marking ambiguous" << std::endl;
+							std::cerr << "marking ambiguous" << std::endl;
 						)
 						mapPlace->second.isAmbiguous = true;
@@ -122,5 +122,5 @@
 
 			PRINT(
-				std::cout << "there are " << selected.size() << " alternatives before elimination" << std::endl;
+				std::cerr << "there are " << selected.size() << " alternatives before elimination" << std::endl;
 			)
 
@@ -182,6 +182,6 @@
 			begin++;
 			PRINT(
-				std::cout << "findSubExprs" << std::endl;
-				printAlts( finder.alternatives, std::cout );
+				std::cerr << "findSubExprs" << std::endl;
+				printAlts( finder.alternatives, std::cerr );
 			)
 			*out++ = finder;
@@ -204,6 +204,6 @@
 		}
 		PRINT(
-			std::cout << "alternatives before prune:" << std::endl;
-			printAlts( alternatives, std::cout );
+			std::cerr << "alternatives before prune:" << std::endl;
+			printAlts( alternatives, std::cerr );
 		)
 		AltList::iterator oldBegin = alternatives.begin();
@@ -221,5 +221,5 @@
 		alternatives.erase( oldBegin, alternatives.end() );
 		PRINT(
-			std::cout << "there are " << alternatives.size() << " alternatives after elimination" << std::endl;
+			std::cerr << "there are " << alternatives.size() << " alternatives after elimination" << std::endl;
 		)
 	}
@@ -261,8 +261,8 @@
 		for ( std::list< Expression* >::iterator actualExpr = actuals.begin(); actualExpr != actuals.end(); ++actualExpr ) {
 			PRINT(
-				std::cout << "actual expression:" << std::endl;
-				(*actualExpr)->print( std::cout, 8 );
-				std::cout << "--- results are" << std::endl;
-				printAll( (*actualExpr)->get_results(), std::cout, 8 );
+				std::cerr << "actual expression:" << std::endl;
+				(*actualExpr)->print( std::cerr, 8 );
+				std::cerr << "--- results are" << std::endl;
+				printAll( (*actualExpr)->get_results(), std::cerr, 8 );
 			)
 			std::list< DeclarationWithType* >::iterator startFormal = formal;
@@ -278,12 +278,12 @@
 				}
 				PRINT(
-					std::cout << std::endl << "converting ";
-					(*actual)->print( std::cout, 8 );
-					std::cout << std::endl << " to ";
-					(*formal)->get_type()->print( std::cout, 8 );
+					std::cerr << std::endl << "converting ";
+					(*actual)->print( std::cerr, 8 );
+					std::cerr << std::endl << " to ";
+					(*formal)->get_type()->print( std::cerr, 8 );
 				)
 				Cost newCost = conversionCost( *actual, (*formal)->get_type(), indexer, alt.env );
 				PRINT(
-					std::cout << std::endl << "cost is" << newCost << std::endl;
+					std::cerr << std::endl << "cost is" << newCost << std::endl;
 				)
 
@@ -323,12 +323,12 @@
 		for ( InferredParams::const_iterator assert = appExpr->get_inferParams().begin(); assert != appExpr->get_inferParams().end(); ++assert ) {
 			PRINT(
-				std::cout << std::endl << "converting ";
-				assert->second.actualType->print( std::cout, 8 );
-				std::cout << std::endl << " to ";
-				assert->second.formalType->print( std::cout, 8 );
+				std::cerr << std::endl << "converting ";
+				assert->second.actualType->print( std::cerr, 8 );
+				std::cerr << std::endl << " to ";
+				assert->second.formalType->print( std::cerr, 8 );
 				)
 				Cost newCost = conversionCost( assert->second.actualType, assert->second.formalType, indexer, alt.env );
 			PRINT(
-				std::cout << std::endl << "cost of conversion is " << newCost << std::endl;
+				std::cerr << std::endl << "cost of conversion is " << newCost << std::endl;
 				)
 				if ( newCost == Cost::infinity ) {
@@ -448,10 +448,10 @@
 		std::list< DeclarationWithType* > candidates;
 		decls.lookupId( curDecl->get_name(), candidates );
-///   if ( candidates.empty() ) { std::cout << "no candidates!" << std::endl; }
+///   if ( candidates.empty() ) { std::cerr << "no candidates!" << std::endl; }
 		for ( std::list< DeclarationWithType* >::const_iterator candidate = candidates.begin(); candidate != candidates.end(); ++candidate ) {
 			PRINT(
-				std::cout << "inferRecursive: candidate is ";
-				(*candidate)->print( std::cout );
-				std::cout << std::endl;
+				std::cerr << "inferRecursive: candidate is ";
+				(*candidate)->print( std::cerr );
+				std::cerr << std::endl;
 			)
 			AssertionSet newHave, newerNeed( newNeed );
@@ -482,9 +482,9 @@
 				varExpr->get_results().push_front( adjType->clone() );
 				PRINT(
-					std::cout << "satisfying assertion " << curDecl->get_uniqueId() << " ";
-					curDecl->print( std::cout );
-					std::cout << " with declaration " << (*candidate)->get_uniqueId() << " ";
-					(*candidate)->print( std::cout );
-					std::cout << std::endl;
+					std::cerr << "satisfying assertion " << curDecl->get_uniqueId() << " ";
+					curDecl->print( std::cerr );
+					std::cerr << " with declaration " << (*candidate)->get_uniqueId() << " ";
+					(*candidate)->print( std::cerr );
+					std::cerr << std::endl;
 				)
 				ApplicationExpr *appExpr = static_cast< ApplicationExpr* >( newerAlt.expr );
@@ -501,13 +501,13 @@
 	void AlternativeFinder::inferParameters( const AssertionSet &need, AssertionSet &have, const Alternative &newAlt, OpenVarSet &openVars, OutputIterator out ) {
 //	PRINT(
-//	    std::cout << "inferParameters: assertions needed are" << std::endl;
-//	    printAll( need, std::cout, 8 );
+//	    std::cerr << "inferParameters: assertions needed are" << std::endl;
+//	    printAll( need, std::cerr, 8 );
 //	    )
 		SymTab::Indexer decls( indexer );
 		PRINT(
-			std::cout << "============= original indexer" << std::endl;
-			indexer.print( std::cout );
-			std::cout << "============= new indexer" << std::endl;
-			decls.print( std::cout );
+			std::cerr << "============= original indexer" << std::endl;
+			indexer.print( std::cerr );
+			std::cerr << "============= new indexer" << std::endl;
+			decls.print( std::cerr );
 		)
 		addToIndexer( have, decls );
@@ -515,5 +515,5 @@
 		inferRecursive( need.begin(), need.end(), newAlt, openVars, decls, newNeed, 0, indexer, out );
 //	PRINT(
-//	    std::cout << "declaration 14 is ";
+//	    std::cerr << "declaration 14 is ";
 //	    Declaration::declFromId
 //	    *out++ = newAlt;
@@ -532,6 +532,6 @@
 			makeExprList( actualAlt, appExpr->get_args() );
 			PRINT(
-				std::cout << "need assertions:" << std::endl;
-				printAssertionSet( resultNeed, std::cout, 8 );
+				std::cerr << "need assertions:" << std::endl;
+				printAssertionSet( resultNeed, std::cerr, 8 );
 			)
 			inferParameters( resultNeed, resultHave, newAlt, openVars, out );
@@ -543,5 +543,7 @@
 		AlternativeFinder funcOpFinder( indexer, env );
 
-		AlternativeFinder funcFinder( indexer, env ); {
+		AlternativeFinder funcFinder( indexer, env );
+
+		{
 			NameExpr *fname = 0;;
 			if ( ( fname = dynamic_cast<NameExpr *>( untypedExpr->get_function()))
@@ -573,6 +575,6 @@
 		for ( AltList::const_iterator func = funcFinder.alternatives.begin(); func != funcFinder.alternatives.end(); ++func ) {
 			PRINT(
-				std::cout << "working on alternative: " << std::endl;
-				func->print( std::cout, 8 );
+				std::cerr << "working on alternative: " << std::endl;
+				func->print( std::cerr, 8 );
 			)
 			// check if the type is pointer to function
@@ -606,6 +608,6 @@
 					}
 					PRINT(
-						std::cout << "known function ops:" << std::endl;
-						printAlts( funcOpFinder.alternatives, std::cout, 8 );
+						std::cerr << "known function ops:" << std::endl;
+						printAlts( funcOpFinder.alternatives, std::cerr, 8 );
 					)
 				}
@@ -639,12 +641,12 @@
 				FunctionType *function = dynamic_cast< FunctionType* >( pointer->get_base() );
 				assert( function );
-				std::cout << "Case +++++++++++++" << std::endl;
-				std::cout << "formals are:" << std::endl;
-				printAll( function->get_parameters(), std::cout, 8 );
-				std::cout << "actuals are:" << std::endl;
-				printAll( appExpr->get_args(), std::cout, 8 );
-				std::cout << "bindings are:" << std::endl;
-				withFunc->env.print( std::cout, 8 );
-				std::cout << "cost of conversion is:" << cvtCost << std::endl;
+				std::cerr << "Case +++++++++++++" << std::endl;
+				std::cerr << "formals are:" << std::endl;
+				printAll( function->get_parameters(), std::cerr, 8 );
+				std::cerr << "actuals are:" << std::endl;
+				printAll( appExpr->get_args(), std::cerr, 8 );
+				std::cerr << "bindings are:" << std::endl;
+				withFunc->env.print( std::cerr, 8 );
+				std::cerr << "cost of conversion is:" << cvtCost << std::endl;
 			)
 			if ( cvtCost != Cost::infinity ) {
@@ -824,5 +826,5 @@
 		}
 	}
-	
+
 	void AlternativeFinder::visit( UntypedOffsetofExpr *offsetofExpr ) {
 		AlternativeFinder funcFinder( indexer, env );
@@ -833,5 +835,5 @@
 		}
 	}
-	
+
 	void AlternativeFinder::visit( OffsetofExpr *offsetofExpr ) {
 		alternatives.push_back( Alternative( offsetofExpr->clone(), env, Cost::zero ) );
@@ -843,9 +845,9 @@
 		assert( function->get_parameters().size() == 1 );
 		PRINT(
-			std::cout << "resolvAttr: funcDecl is ";
-			funcDecl->print( std::cout );
-			std::cout << " argType is ";
-			argType->print( std::cout );
-			std::cout << std::endl;
+			std::cerr << "resolvAttr: funcDecl is ";
+			funcDecl->print( std::cerr );
+			std::cerr << " argType is ";
+			argType->print( std::cerr );
+			std::cerr << std::endl;
 		)
 		if ( typesCompatibleIgnoreQualifiers( argType, function->get_parameters().front()->get_type(), indexer, env ) ) {
