Index: src/ResolvExpr/AlternativeFinder.cc
===================================================================
--- src/ResolvExpr/AlternativeFinder.cc	(revision eb50842f528b3e34cf566df4d08aa8c6d4b077a8)
+++ src/ResolvExpr/AlternativeFinder.cc	(revision 937e51d79693364ccc3aec416b5db0894464e624)
@@ -10,6 +10,6 @@
 // Created On       : Sat May 16 23:52:08 2015
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Sat May 16 23:55:30 2015
-// Update Count     : 3
+// Last Modified On : Mon Jun 22 17:19:54 2015
+// Update Count     : 17
 //
 
@@ -108,10 +108,10 @@
 						PRINT(
 							std::cout << "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;
-							)
+						)
 						mapPlace->second.isAmbiguous = true;
 					}
@@ -123,5 +123,5 @@
 			PRINT(
 				std::cout << "there are " << selected.size() << " alternatives before elimination" << std::endl;
-				)
+			)
 
 			// accept the alternatives that were unambiguous
@@ -184,5 +184,5 @@
 				std::cout << "findSubExprs" << std::endl;
 				printAlts( finder.alternatives, std::cout );
-				)
+			)
 			*out++ = finder;
 		}
@@ -206,9 +206,9 @@
 			std::cout << "alternatives before prune:" << std::endl;
 			printAlts( alternatives, std::cout );
-			)
+		)
 		AltList::iterator oldBegin = alternatives.begin();
 		pruneAlternatives( alternatives.begin(), alternatives.end(), front_inserter( alternatives ), indexer );
 		if ( alternatives.begin() == oldBegin ) {
-			std::ostrstream stream;
+			std::ostringstream stream;
 			stream << "Can't choose between alternatives for expression ";
 			expr->print( stream );
@@ -217,10 +217,10 @@
 			findMinCost( alternatives.begin(), alternatives.end(), back_inserter( winners ) );
 			printAlts( winners, stream, 8 );
-			throw SemanticError( std::string( stream.str(), stream.pcount() ) );
+			throw SemanticError( stream.str() );
 		}
 		alternatives.erase( oldBegin, alternatives.end() );
 		PRINT(
 			std::cout << "there are " << alternatives.size() << " alternatives after elimination" << std::endl;
-			)
+		)
 	}
 
@@ -265,6 +265,6 @@
 				std::cout << "--- results are" << std::endl;
 				printAll( (*actualExpr)->get_results(), std::cout, 8 );
-				)
-				std::list< DeclarationWithType* >::iterator startFormal = formal;
+			)
+			std::list< DeclarationWithType* >::iterator startFormal = formal;
 			Cost actualCost;
 			for ( std::list< Type* >::iterator actual = (*actualExpr)->get_results().begin(); actual != (*actualExpr)->get_results().end(); ++actual ) {
@@ -282,13 +282,13 @@
 					std::cout << std::endl << " to ";
 					(*formal)->get_type()->print( std::cout, 8 );
-					)
-					Cost newCost = conversionCost( *actual, (*formal)->get_type(), indexer, alt.env );
+				)
+				Cost newCost = conversionCost( *actual, (*formal)->get_type(), indexer, alt.env );
 				PRINT(
 					std::cout << std::endl << "cost is" << newCost << std::endl;
-					)
-
-					if ( newCost == Cost::infinity ) {
-						return newCost;
-					}
+				)
+
+				if ( newCost == Cost::infinity ) {
+					return newCost;
+				}
 				convCost += newCost;
 				actualCost += newCost;
@@ -381,5 +381,5 @@
 					(*actual)->print( std::cerr );
 					std::cerr << std::endl;
-					)
+				)
 				if ( ! unify( (*formal)->get_type(), *actual, resultEnv, resultNeed, resultHave, openVars, indexer ) ) {
 					return false;
@@ -429,5 +429,5 @@
 					std::cerr << "recursing with new set:" << std::endl;
 					printAssertionSet( newNeed, std::cerr, 8 );
-					)
+				)
 				inferRecursive( newNeed.begin(), newNeed.end(), newAlt, openVars, decls, newerNeed, level+1, indexer, out );
 				return;
@@ -444,5 +444,5 @@
 			curDecl->print( std::cerr );
 			std::cerr << std::endl;
-			)
+		)
 		std::list< DeclarationWithType* > candidates;
 		decls.lookupId( curDecl->get_name(), candidates );
@@ -453,5 +453,5 @@
 				(*candidate)->print( std::cout );
 				std::cout << std::endl;
-				)
+			)
 			AssertionSet newHave, newerNeed( newNeed );
 			TypeEnvironment newEnv( newAlt.env );
@@ -466,9 +466,9 @@
 				adjType->print( std::cerr );
 				std::cerr << std::endl;
-				)
+			)
 			if ( unify( curDecl->get_type(), adjType, newEnv, newerNeed, newHave, newOpenVars, indexer ) ) {
 				PRINT(
 					std::cerr << "success!" << std::endl;
-					)
+				)
 				SymTab::Indexer newDecls( decls );
 				addToIndexer( newHave, newDecls );
@@ -486,5 +486,5 @@
 					(*candidate)->print( std::cout );
 					std::cout << std::endl;
-					)
+				)
 				ApplicationExpr *appExpr = static_cast< ApplicationExpr* >( newerAlt.expr );
 				// XXX: this is a memory leak, but adjType can't be deleted because it might contain assertions
@@ -509,5 +509,5 @@
 			std::cout << "============= new indexer" << std::endl;
 			decls.print( std::cout );
-			)
+		)
 		addToIndexer( have, decls );
 		AssertionSet newNeed;
@@ -533,5 +533,5 @@
 				std::cout << "need assertions:" << std::endl;
 				printAssertionSet( resultNeed, std::cout, 8 );
-				)
+			)
 			inferParameters( resultNeed, resultHave, newAlt, openVars, out );
 		}
@@ -542,11 +542,9 @@
 		AlternativeFinder funcOpFinder( indexer, env );
 
-		AlternativeFinder funcFinder( indexer, env );
-
-		{
+		AlternativeFinder funcFinder( indexer, env ); {
 			NameExpr *fname;
 			if ( ( fname = dynamic_cast<NameExpr *>( untypedExpr->get_function()))
-				 && ( fname->get_name() == std::string("LabAddress")) ) {
-				alternatives.push_back( Alternative( untypedExpr, env, Cost()) );
+				 && ( fname->get_name() == std::string("&&")) ) {
+				alternatives.push_back( Alternative( untypedExpr->clone(), env, Cost()) );
 				return;
 			}
@@ -562,5 +560,5 @@
 		Tuples::TupleAssignSpotter tassign( this );
 		if ( tassign.isTupleAssignment( untypedExpr, possibilities ) ) {
-			// TODO take care of possible tuple assignments, or discard expression
+			// take care of possible tuple assignments, or discard expression
 			return;
 		} // else ...
@@ -572,5 +570,5 @@
 				std::cout << "working on alternative: " << std::endl;
 				func->print( std::cout, 8 );
-				)
+			)
 			// check if the type is pointer to function
 			PointerType *pointer;
@@ -605,5 +603,5 @@
 						std::cout << "known function ops:" << std::endl;
 						printAlts( funcOpFinder.alternatives, std::cout, 8 );
-						)
+					)
 				}
 
@@ -644,9 +642,9 @@
 				withFunc->env.print( std::cout, 8 );
 				std::cout << "cost of conversion is:" << cvtCost << std::endl;
-				)
-				if ( cvtCost != Cost::infinity ) {
-					withFunc->cvtCost = cvtCost;
-					alternatives.push_back( *withFunc );
-				} // if
+			)
+			if ( cvtCost != Cost::infinity ) {
+				withFunc->cvtCost = cvtCost;
+				alternatives.push_back( *withFunc );
+			} // if
 		} // for
 		candidates.clear();
@@ -749,5 +747,5 @@
 				newExpr.print( std::cerr );
 				std::cerr << std::endl;
-				)
+			)
 			renameTypes( alternatives.back().expr );
 			if ( StructInstType *structInst = dynamic_cast< StructInstType* >( (*i)->get_type() ) ) {
@@ -796,11 +794,11 @@
 			argType->print( std::cout );
 			std::cout << std::endl;
-			)
-			if ( typesCompatibleIgnoreQualifiers( argType, function->get_parameters().front()->get_type(), indexer, env ) ) {
-				alternatives.push_back( Alternative( new AttrExpr( new VariableExpr( funcDecl ), argType->clone() ), env, Cost::zero ) );
-				for ( std::list< DeclarationWithType* >::iterator i = function->get_returnVals().begin(); i != function->get_returnVals().end(); ++i ) {
-					alternatives.back().expr->get_results().push_back( (*i)->get_type()->clone() );
-				} // for
-			} // if
+		)
+		if ( typesCompatibleIgnoreQualifiers( argType, function->get_parameters().front()->get_type(), indexer, env ) ) {
+			alternatives.push_back( Alternative( new AttrExpr( new VariableExpr( funcDecl ), argType->clone() ), env, Cost::zero ) );
+			for ( std::list< DeclarationWithType* >::iterator i = function->get_returnVals().begin(); i != function->get_returnVals().end(); ++i ) {
+				alternatives.back().expr->get_results().push_back( (*i)->get_type()->clone() );
+			} // for
+		} // if
 	}
 
Index: src/ResolvExpr/RenameVars.cc
===================================================================
--- src/ResolvExpr/RenameVars.cc	(revision eb50842f528b3e34cf566df4d08aa8c6d4b077a8)
+++ src/ResolvExpr/RenameVars.cc	(revision 937e51d79693364ccc3aec416b5db0894464e624)
@@ -10,9 +10,9 @@
 // Created On       : Sun May 17 12:05:18 2015
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Sun May 17 12:07:59 2015
-// Update Count     : 2
+// Last Modified On : Mon Jun  8 14:51:35 2015
+// Update Count     : 4
 //
 
-#include <strstream>
+#include <sstream>
 
 #include "RenameVars.h"
@@ -122,7 +122,7 @@
 			// renames all "forall" type names to `_${level}_${name}'
 			for ( std::list< TypeDecl* >::iterator i = type->get_forall().begin(); i != type->get_forall().end(); ++i ) {
-				std::ostrstream output;
+				std::ostringstream output;
 				output << "_" << level << "_" << (*i)->get_name();
-				std::string newname( output.str(), output.pcount() );
+				std::string newname( output.str() );
 				mapStack.front()[ (*i)->get_name() ] = newname;
 				(*i)->set_name( newname );
Index: src/ResolvExpr/Resolver.cc
===================================================================
--- src/ResolvExpr/Resolver.cc	(revision eb50842f528b3e34cf566df4d08aa8c6d4b077a8)
+++ src/ResolvExpr/Resolver.cc	(revision 937e51d79693364ccc3aec416b5db0894464e624)
@@ -9,7 +9,7 @@
 // Author           : Richard C. Bilson
 // Created On       : Sun May 17 12:17:01 2015
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Sun May 17 12:18:17 2015
-// Update Count     : 2
+// Last Modified By : Rob Schluntz
+// Last Modified On : Wed Jun 24 16:20:35 2015
+// Update Count     : 156
 //
 
@@ -38,4 +38,6 @@
 		virtual void visit( TypeDecl *typeDecl );
 
+		virtual void visit( ArrayType * at );
+
 		virtual void visit( ExprStmt *exprStmt );
 		virtual void visit( IfStmt *ifStmt );
@@ -45,4 +47,5 @@
 		virtual void visit( ChooseStmt *switchStmt );
 		virtual void visit( CaseStmt *caseStmt );
+		virtual void visit( BranchStmt *branchStmt );
 		virtual void visit( ReturnStmt *returnStmt );
 
@@ -50,4 +53,9 @@
 		virtual void visit( ListInit *listInit );
 	  private:
+  	typedef std::list< Initializer * >::iterator InitIterator;
+
+	  void resolveAggrInit( AggregateDecl *, InitIterator &, InitIterator & );
+	  void resolveSingleAggrInit( Declaration *, InitIterator &, InitIterator & );
+
 		std::list< Type * > functionReturn;
 		Type *initContext;
@@ -158,5 +166,16 @@
 		SymTab::Indexer::visit( objectDecl );
 	}
-  
+
+	void Resolver::visit( ArrayType * at ) {
+		if ( at->get_dimension() ) {
+			BasicType arrayLenType = BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt );
+			CastExpr *castExpr = new CastExpr( at->get_dimension(), arrayLenType.clone() );
+			Expression *newExpr = findSingleExpression( castExpr, *this );
+			delete at->get_dimension();
+			at->set_dimension( newExpr );
+		}
+		Visitor::visit( at );
+	}
+
 	void Resolver::visit( TypeDecl *typeDecl ) {
 		if ( typeDecl->get_base() ) {
@@ -166,5 +185,5 @@
 		SymTab::Indexer::visit( typeDecl );
 	}
-  
+
 	void Resolver::visit( FunctionDecl *functionDecl ) {
 #if 0
@@ -252,4 +271,17 @@
 	}
 
+	void Resolver::visit( BranchStmt *branchStmt ) {
+		// must resolve the argument for a computed goto
+		if ( branchStmt->get_type() == BranchStmt::Goto ) { // check for computed goto statement
+			if ( NameExpr * arg = dynamic_cast< NameExpr * >( branchStmt->get_computedTarget() ) ) {
+				VoidType v = Type::Qualifiers();		// cast to void * for the alternative finder
+				PointerType pt( Type::Qualifiers(), v.clone() );
+				CastExpr * castExpr = new CastExpr( arg, pt.clone() );
+				Expression * newExpr = findSingleExpression( castExpr, *this ); // find best expression
+				branchStmt->set_target( newExpr );
+			} // if
+		} // if
+	}
+
 	void Resolver::visit( ReturnStmt *returnStmt ) {
 		if ( returnStmt->get_expr() ) {
@@ -260,4 +292,13 @@
 			returnStmt->set_expr( newExpr );
 		} // if
+	}
+
+	template< typename T >
+	bool isCharType( T t ) {
+		if ( BasicType * bt = dynamic_cast< BasicType * >( t ) ) {
+			return bt->get_kind() == BasicType::Char || bt->get_kind() == BasicType::SignedChar || 
+				bt->get_kind() == BasicType::UnsignedChar;
+		}
+		return false;
 	}
 
@@ -286,10 +327,81 @@
 			delete castExpr;
 			singleInit->set_value( newExpr );
+
+			// check if initializing type is char[]
+			if ( ArrayType * at = dynamic_cast< ArrayType * >( initContext ) ) {
+				if ( isCharType( at->get_base() ) ) {
+					// check if the resolved type is char *
+					if ( PointerType * pt = dynamic_cast< PointerType *>( newExpr->get_results().front() ) ) {
+						if ( isCharType( pt->get_base() ) ) {
+							// strip cast if we're initializing a char[] with a char *, e.g.
+							// char x[] = "hello";
+							CastExpr *ce = dynamic_cast< CastExpr * >( newExpr );
+							singleInit->set_value( ce->get_arg() );
+							ce->set_arg( NULL );
+							delete ce;									
+						}
+					}
+				}
+			}
 		} // if
 //	singleInit->get_value()->accept( *this );
 	}
 
-	void Resolver::visit( ListInit *listInit ) {
-		Visitor::visit(listInit);
+	void Resolver::resolveSingleAggrInit( Declaration * dcl, InitIterator & init, InitIterator & initEnd ) {
+		DeclarationWithType * dt = dynamic_cast< DeclarationWithType * >( dcl );
+		assert( dt );
+		initContext = dt->get_type();
+		try {
+			if ( init == initEnd ) return; // stop when there are no more initializers
+			(*init)->accept( *this );
+			++init; // made it past an initializer
+		} catch( SemanticError & ) {
+			// need to delve deeper, if you can
+			if ( StructInstType * sit = dynamic_cast< StructInstType * >( dt->get_type() ) ) {
+				resolveAggrInit( sit->get_baseStruct(), init, initEnd );
+			} else if ( UnionInstType * uit = dynamic_cast< UnionInstType * >( dt->get_type() ) ) {
+				resolveAggrInit( uit->get_baseUnion(), init, initEnd );
+			} else {
+				// member is not an aggregate type, so can't go any deeper
+
+				// might need to rethink what is being thrown
+				throw;
+			} // if
+		}
+	}
+
+	void Resolver::resolveAggrInit( AggregateDecl * aggr, InitIterator & init, InitIterator & initEnd ) {
+		if ( StructDecl * st = dynamic_cast< StructDecl * >( aggr ) ) {
+			// want to resolve each initializer to the members of the struct,
+			// but if there are more initializers than members we should stop
+			list< Declaration * >::iterator it = st->get_members().begin();
+			for ( ; it != st->get_members().end(); ++it) {
+				resolveSingleAggrInit( *it, init, initEnd );
+			}
+		} else if ( UnionDecl * un = dynamic_cast< UnionDecl * >( aggr ) ) {
+			// only resolve to the first member of a union
+			resolveSingleAggrInit( *un->get_members().begin(), init, initEnd );
+		} // if
+	}
+
+	void Resolver::visit( ListInit * listInit ) {
+		InitIterator iter = listInit->begin_initializers();
+		InitIterator end = listInit->end_initializers();
+
+		if ( ArrayType * at = dynamic_cast< ArrayType * >( initContext ) ) {
+			// resolve each member to the base type of the array
+			for ( ; iter != end; ++iter ) {
+				initContext = at->get_base();
+				(*iter)->accept( *this );
+			} // for
+		} else if ( StructInstType * st = dynamic_cast< StructInstType * >( initContext ) ) {
+			resolveAggrInit( st->get_baseStruct(), iter, end );
+		} else if ( UnionInstType *st = dynamic_cast< UnionInstType * >( initContext ) ) {
+			resolveAggrInit( st->get_baseUnion(), iter, end );
+		} else {
+			// basic types are handled here
+			Visitor::visit( listInit );
+		}
+
 #if 0
 		if ( ArrayType *at = dynamic_cast<ArrayType*>(initContext) ) {
Index: src/ResolvExpr/module.mk
===================================================================
--- src/ResolvExpr/module.mk	(revision eb50842f528b3e34cf566df4d08aa8c6d4b077a8)
+++ src/ResolvExpr/module.mk	(revision 937e51d79693364ccc3aec416b5db0894464e624)
@@ -1,4 +1,20 @@
+######################### -*- Mode: Makefile-Gmake -*- ########################
+##
+## 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.
+##
+## module.mk -- 
+##
+## Author           : Richard C. Bilson
+## Created On       : Mon Jun  1 17:49:17 2015
+## Last Modified By : Peter A. Buhr
+## Last Modified On : Mon Jun  1 17:53:28 2015
+## Update Count     : 1
+###############################################################################
+
 SRC += ResolvExpr/AlternativeFinder.cc \
-      ResolvExpr/Alternative.cc \
+       ResolvExpr/Alternative.cc \
        ResolvExpr/Unify.cc \
        ResolvExpr/PtrsAssignable.cc \
@@ -16,3 +32,2 @@
        ResolvExpr/Occurs.cc \
        ResolvExpr/TypeEnvironment.cc
-       
