Index: src/AST/Convert.cpp
===================================================================
--- src/AST/Convert.cpp	(revision 30d91e4132fb7ec560dd389474deafbfd0d57555)
+++ src/AST/Convert.cpp	(revision 365c8dcbd76a5d6cafc342a140f686a573523fea)
@@ -951,4 +951,10 @@
 	}
 
+	const ast::Expr * visit( const ast::DimensionExpr * node ) override final {
+		auto expr = visitBaseExpr( node, new DimensionExpr( node->name ) );
+		this->node = expr;
+		return nullptr;
+	}
+
 	const ast::Expr * visit( const ast::AsmExpr * node ) override final {
 		auto expr = visitBaseExpr( node,
@@ -2463,12 +2469,7 @@
 
 	virtual void visit( const DimensionExpr * old ) override final {
-		// DimensionExpr gets desugared away in Validate.
-		// As long as new-AST passes don't use it, this cheap-cheerful error
-		// detection helps ensure that these occurrences have been compiled
-		// away, as expected.  To move the DimensionExpr boundary downstream
-		// or move the new-AST translation boundary upstream, implement
-		// DimensionExpr in the new AST and implement a conversion.
-		(void) old;
-		assert(false && "DimensionExpr should not be present at new-AST boundary");
+		this->node = visitBaseExpr( old,
+			new ast::DimensionExpr( old->location, old->name )
+		);
 	}
 
Index: src/AST/Expr.hpp
===================================================================
--- src/AST/Expr.hpp	(revision 30d91e4132fb7ec560dd389474deafbfd0d57555)
+++ src/AST/Expr.hpp	(revision 365c8dcbd76a5d6cafc342a140f686a573523fea)
@@ -604,4 +604,17 @@
 };
 
+class DimensionExpr final : public Expr {
+public:
+	std::string name;
+
+	DimensionExpr( const CodeLocation & loc, std::string name )
+	: Expr( loc ), name( name ) {}
+
+	const Expr * accept( Visitor & v ) const override { return v.visit( this ); }
+private:
+	DimensionExpr * clone() const override { return new DimensionExpr{ *this }; }
+	MUTATE_FRIEND
+};
+
 /// A GCC "asm constraint operand" used in an asm statement, e.g. `[output] "=f" (result)`.
 /// https://gcc.gnu.org/onlinedocs/gcc-4.7.1/gcc/Machine-Constraints.html#Machine-Constraints
Index: src/AST/Fwd.hpp
===================================================================
--- src/AST/Fwd.hpp	(revision 30d91e4132fb7ec560dd389474deafbfd0d57555)
+++ src/AST/Fwd.hpp	(revision 365c8dcbd76a5d6cafc342a140f686a573523fea)
@@ -84,4 +84,5 @@
 class CommaExpr;
 class TypeExpr;
+class DimensionExpr;
 class AsmExpr;
 class ImplicitCopyCtorExpr;
Index: src/AST/Pass.hpp
===================================================================
--- src/AST/Pass.hpp	(revision 30d91e4132fb7ec560dd389474deafbfd0d57555)
+++ src/AST/Pass.hpp	(revision 365c8dcbd76a5d6cafc342a140f686a573523fea)
@@ -184,4 +184,5 @@
 	const ast::Expr *             visit( const ast::CommaExpr            * ) override final;
 	const ast::Expr *             visit( const ast::TypeExpr             * ) override final;
+	const ast::Expr *             visit( const ast::DimensionExpr        * ) override final;
 	const ast::Expr *             visit( const ast::AsmExpr              * ) override final;
 	const ast::Expr *             visit( const ast::ImplicitCopyCtorExpr * ) override final;
Index: src/AST/Pass.impl.hpp
===================================================================
--- src/AST/Pass.impl.hpp	(revision 30d91e4132fb7ec560dd389474deafbfd0d57555)
+++ src/AST/Pass.impl.hpp	(revision 365c8dcbd76a5d6cafc342a140f686a573523fea)
@@ -575,10 +575,9 @@
 			__pass::symtab::addId( core, 0, func );
 			if ( __visit_children() ) {
-				// parameter declarations
+				maybe_accept( node, &FunctionDecl::type_params );
+				maybe_accept( node, &FunctionDecl::assertions );
 				maybe_accept( node, &FunctionDecl::params );
 				maybe_accept( node, &FunctionDecl::returns );
-				// type params and assertions
-				maybe_accept( node, &FunctionDecl::type_params );
-				maybe_accept( node, &FunctionDecl::assertions );
+				maybe_accept( node, &FunctionDecl::type );
 				// First remember that we are now within a function.
 				ValueGuard< bool > oldInFunction( inFunction );
@@ -1522,4 +1521,18 @@
 
 //--------------------------------------------------------------------------
+// DimensionExpr
+template< typename core_t >
+const ast::Expr * ast::Pass< core_t >::visit( const ast::DimensionExpr * node ) {
+	VISIT_START( node );
+
+	if ( __visit_children() ) {
+		guard_symtab guard { *this };
+		maybe_accept( node, &DimensionExpr::result );
+	}
+
+	VISIT_END( Expr, node );
+}
+
+//--------------------------------------------------------------------------
 // AsmExpr
 template< typename core_t >
@@ -1859,5 +1872,5 @@
 
 	if ( __visit_children() ) {
-		// xxx - should PointerType visit/mutate dimension?
+		maybe_accept( node, &PointerType::dimension );
 		maybe_accept( node, &PointerType::base );
 	}
Index: src/AST/Pass.proto.hpp
===================================================================
--- src/AST/Pass.proto.hpp	(revision 30d91e4132fb7ec560dd389474deafbfd0d57555)
+++ src/AST/Pass.proto.hpp	(revision 365c8dcbd76a5d6cafc342a140f686a573523fea)
@@ -26,4 +26,7 @@
 
 struct PureVisitor;
+
+template<typename node_t>
+node_t * deepCopy( const node_t * localRoot );
 
 namespace __pass {
@@ -396,5 +399,7 @@
 		static inline auto addStructFwd( core_t & core, int, const ast::StructDecl * decl ) -> decltype( core.symtab.addStruct( decl ), void() ) {
 			ast::StructDecl * fwd = new ast::StructDecl( decl->location, decl->name );
-			fwd->params = decl->params;
+			for ( const auto & param : decl->params ) {
+				fwd->params.push_back( deepCopy( param.get() ) );
+			}
 			core.symtab.addStruct( fwd );
 		}
@@ -405,6 +410,8 @@
 		template<typename core_t>
 		static inline auto addUnionFwd( core_t & core, int, const ast::UnionDecl * decl ) -> decltype( core.symtab.addUnion( decl ), void() ) {
-			UnionDecl * fwd = new UnionDecl( decl->location, decl->name );
-			fwd->params = decl->params;
+			ast::UnionDecl * fwd = new ast::UnionDecl( decl->location, decl->name );
+			for ( const auto & param : decl->params ) {
+				fwd->params.push_back( deepCopy( param.get() ) );
+			}
 			core.symtab.addUnion( fwd );
 		}
Index: src/AST/Print.cpp
===================================================================
--- src/AST/Print.cpp	(revision 30d91e4132fb7ec560dd389474deafbfd0d57555)
+++ src/AST/Print.cpp	(revision 365c8dcbd76a5d6cafc342a140f686a573523fea)
@@ -1101,4 +1101,11 @@
 	}
 
+	virtual const ast::Expr * visit( const ast::DimensionExpr * node ) override final {
+		os << "Type-Sys Value: " << node->name;
+		postprint( node );
+
+		return node;
+	}
+
 	virtual const ast::Expr * visit( const ast::AsmExpr * node ) override final {
 		os << "Asm Expression:" << endl;
Index: src/AST/Visitor.hpp
===================================================================
--- src/AST/Visitor.hpp	(revision 30d91e4132fb7ec560dd389474deafbfd0d57555)
+++ src/AST/Visitor.hpp	(revision 365c8dcbd76a5d6cafc342a140f686a573523fea)
@@ -76,4 +76,5 @@
     virtual const ast::Expr *             visit( const ast::CommaExpr            * ) = 0;
     virtual const ast::Expr *             visit( const ast::TypeExpr             * ) = 0;
+    virtual const ast::Expr *             visit( const ast::DimensionExpr        * ) = 0;
     virtual const ast::Expr *             visit( const ast::AsmExpr              * ) = 0;
     virtual const ast::Expr *             visit( const ast::ImplicitCopyCtorExpr * ) = 0;
Index: src/Common/CodeLocationTools.cpp
===================================================================
--- src/Common/CodeLocationTools.cpp	(revision 30d91e4132fb7ec560dd389474deafbfd0d57555)
+++ src/Common/CodeLocationTools.cpp	(revision 365c8dcbd76a5d6cafc342a140f686a573523fea)
@@ -147,4 +147,5 @@
     macro(CommaExpr, Expr) \
     macro(TypeExpr, Expr) \
+    macro(DimensionExpr, Expr) \
     macro(AsmExpr, Expr) \
     macro(ImplicitCopyCtorExpr, Expr) \
Index: src/InitTweak/GenInit.cc
===================================================================
--- src/InitTweak/GenInit.cc	(revision 30d91e4132fb7ec560dd389474deafbfd0d57555)
+++ src/InitTweak/GenInit.cc	(revision 365c8dcbd76a5d6cafc342a140f686a573523fea)
@@ -402,8 +402,8 @@
 					retVal->location, "?{}", retVal, stmt->expr );
 				assertf( ctorStmt,
-					"ReturnFixer: genCtorDtor returned nllptr: %s / %s",
+					"ReturnFixer: genCtorDtor returned nullptr: %s / %s",
 					toString( retVal ).c_str(),
 					toString( stmt->expr ).c_str() );
-					stmtsToAddBefore.push_back( ctorStmt );
+				stmtsToAddBefore.push_back( ctorStmt );
 
 				// Return the retVal object.
@@ -421,4 +421,8 @@
 	void genInit( ast::TranslationUnit & transUnit ) {
 		ast::Pass<HoistArrayDimension_NoResolve_New>::run( transUnit );
+		ast::Pass<ReturnFixer_New>::run( transUnit );
+	}
+
+	void fixReturnStatements( ast::TranslationUnit & transUnit ) {
 		ast::Pass<ReturnFixer_New>::run( transUnit );
 	}
Index: src/InitTweak/GenInit.h
===================================================================
--- src/InitTweak/GenInit.h	(revision 30d91e4132fb7ec560dd389474deafbfd0d57555)
+++ src/InitTweak/GenInit.h	(revision 365c8dcbd76a5d6cafc342a140f686a573523fea)
@@ -10,6 +10,6 @@
 // Created On       : Mon May 18 07:44:20 2015
 // Last Modified By : Andrew Beach
-// Last Modified On : Fri Oct 22 16:08:00 2021
-// Update Count     : 6
+// Last Modified On : Fri Mar 18 14:22:00 2022
+// Update Count     : 7
 //
 
@@ -31,4 +31,5 @@
 	/// Converts return statements into copy constructor calls on the hidden return variable
 	void fixReturnStatements( std::list< Declaration * > & translationUnit );
+	void fixReturnStatements( ast::TranslationUnit & translationUnit );
 
 	/// generates a single ctor/dtor statement using objDecl as the 'this' parameter and arg as the optional argument
Index: src/Validate/GenericParameter.cpp
===================================================================
--- src/Validate/GenericParameter.cpp	(revision 365c8dcbd76a5d6cafc342a140f686a573523fea)
+++ src/Validate/GenericParameter.cpp	(revision 365c8dcbd76a5d6cafc342a140f686a573523fea)
@@ -0,0 +1,298 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2018 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// GenericParameter.hpp --
+//
+// Author           : Andrew Beach
+// Created On       : Fri Mar 21 10:02:00 2022
+// Last Modified By : Andrew Beach
+// Last Modified On : Wed Apr 13 10:09:00 2022
+// Update Count     : 0
+//
+
+#include "GenericParameter.hpp"
+
+#include "AST/Decl.hpp"
+#include "AST/Expr.hpp"
+#include "AST/ParseNode.hpp"
+#include "AST/Pass.hpp"
+#include "AST/TranslationUnit.hpp"
+#include "AST/Type.hpp"
+
+namespace Validate {
+
+namespace {
+
+// Test for special name on a generic parameter.  Special treatment for the
+// special name is a bootstrapping hack.  In most cases, the worlds of T's
+// and of N's don't overlap (normal treamtemt).  The foundations in
+// array.hfa use tagging for both types and dimensions.  Tagging treats
+// its subject parameter even more opaquely than T&, which assumes it is
+// possible to have a pointer/reference to such an object.  Tagging only
+// seeks to identify the type-system resident at compile time.  Both N's
+// and T's can make tags.  The tag definition uses the special name, which
+// is treated as "an N or a T."  This feature is not inteded to be used
+// outside of the definition and immediate uses of a tag.
+inline bool isReservedTysysIdOnlyName( const std::string & name ) {
+	// The name might be wrapped in __..._generic so check for that as well.
+	int foundAt = name.find("__CFA_tysys_id_only");
+	if (foundAt == 0) return true;
+	if (foundAt == 2 && name[0] == '_' && name[1] == '_') return true;
+	return false;
+}
+
+template< typename InstType >
+const InstType * validateGeneric(
+		const CodeLocation & location, const InstType * type ) {
+	const typename InstType::base_type * base = type->base.get();
+	if ( nullptr == base ) {
+		return type;
+	}
+
+	const std::vector<ast::ptr<ast::TypeDecl>> & params = base->params;
+	if ( params.empty() ) {
+		return type;
+	}
+
+	// I think I can move this check up, or it should check the result of
+	// the substuition.
+
+	auto mutType = ast::mutate( type );
+	std::vector<ast::ptr<ast::Expr>> & args = mutType->params;
+
+	// Quick check before we get into the real work.
+	if ( params.size() < args.size() ) {
+		SemanticError( location, type, "Too many type arguments in generic type " );
+	}
+
+	// Insert defaults arguments when a type argument is missing (currently
+	// only supports missing arguments at the end of the list).
+	// A substitution is used to ensure that defaults are replaced correctly:
+	//   forall(otype T, otype alloc = heap_allocator(T)) struct vector;
+	//   vector(int) v;
+	// After insertion of default values becomes:
+	//   vector(int, heap_allocator(T))
+	// The substitution is built with T=int so the result is:
+	//   vector(int, heap_allocator(int))
+
+	ast::TypeSubstitution sub;
+	// Build the substution:
+	auto paramIter = params.begin();
+	auto argIter = args.begin();
+	for ( ; paramIter != params.end() ; ++paramIter, ++argIter ) {
+		if ( argIter != args.end() ) {
+			if ( auto expr = argIter->as<ast::TypeExpr>() ) {
+				sub.add( paramIter->get(), ast::deepCopy( expr->type ) );
+			}
+		} else if ( const ast::Type * defaultType = (*paramIter)->init ) {
+			args.push_back( new ast::TypeExpr(
+				location, ast::deepCopy( defaultType ) ) );
+			sub.add( paramIter->get(), ast::deepCopy( defaultType ) );
+			argIter = std::prev( args.end() );
+		} else {
+			SemanticError( location, type, "Too few type arguments in generic type " );
+		}
+		assert( argIter != args.end() );
+		bool typeParamDeclared = (*paramIter)->kind != ast::TypeDecl::Dimension;
+		bool typeArgGiven;
+		if ( isReservedTysysIdOnlyName( (*paramIter)->name ) ) {
+			// Always match when declaration is reserved name, means "either".
+			typeArgGiven = typeParamDeclared;
+		} else {
+			typeArgGiven = argIter->as<ast::TypeExpr>();
+		}
+		if ( !typeParamDeclared && typeArgGiven ) {
+			SemanticError( location, type, "Type argument given for value parameter: " );
+		}
+		if ( typeParamDeclared && !typeArgGiven ) {
+			SemanticError( location, type, "Expression argument given for type parameter: " );
+		}
+	}
+
+	// Actually do the application:
+	auto result = sub.apply( mutType );
+	return result.node.release();
+}
+
+struct ValidateGenericParamsCore : public ast::WithGuards {
+	const CodeLocation * locationPtr = nullptr;
+
+	void previsit( const ast::ParseNode * node ) {
+		GuardValue( locationPtr ) = &node->location;
+	}
+
+	const ast::StructInstType * previsit( const ast::StructInstType * type ) {
+		assert( locationPtr );
+		return validateGeneric( *locationPtr, type );
+	}
+
+	const ast::UnionInstType * previsit( const ast::UnionInstType * type ) {
+		assert( locationPtr );
+		return validateGeneric( *locationPtr, type );
+	}
+};
+
+// --------------------------------------------------------------------------
+
+// A SymbolTable that only has the operations used in the Translate Dimension
+// pass. More importantly, it doesn't have some methods that should no be
+// called by the Pass template (lookupId and addId).
+class NoIdSymbolTable {
+	ast::SymbolTable base;
+public:
+#	define FORWARD_X( func, types_and_names, just_names ) \
+	inline auto func types_and_names -> decltype( base.func just_names ) { \
+		return base.func just_names ; \
+	}
+#	define FORWARD_0( func )         FORWARD_X( func, (),             () )
+#	define FORWARD_1( func, type )   FORWARD_X( func, (type arg),     (arg) )
+#	define FORWARD_2( func, t0, t1 ) FORWARD_X( func, (t0 a0, t1 a1), (a0, a1) )
+
+	FORWARD_0( enterScope )
+	FORWARD_0( leaveScope )
+	FORWARD_1( lookupType, const std::string &        )
+	FORWARD_1( addType   , const ast::NamedTypeDecl * )
+	FORWARD_1( addStruct , const ast::StructDecl *    )
+	FORWARD_1( addEnum   , const ast::EnumDecl *      )
+	FORWARD_1( addUnion  , const ast::UnionDecl *     )
+	FORWARD_1( addTrait  , const ast::TraitDecl *     )
+	FORWARD_2( addWith   , const std::vector< ast::ptr<ast::Expr> > &, const ast::Decl * )
+};
+
+struct TranslateDimensionCore : public ast::WithGuards {
+	NoIdSymbolTable symtab;
+
+	// SUIT: Struct- or Union- InstType
+	// Situational awareness:
+	// array( float, [[currentExpr]]     )  has  visitingChildOfSUIT == true
+	// array( float, [[currentExpr]] - 1 )  has  visitingChildOfSUIT == false
+	// size_t x =    [[currentExpr]]        has  visitingChildOfSUIT == false
+	bool nextVisitedNodeIsChildOfSUIT = false;
+	bool visitingChildOfSUIT = false;
+	void changeState_ChildOfSUIT( bool newValue ) {
+		GuardValue( visitingChildOfSUIT ) = nextVisitedNodeIsChildOfSUIT;
+		GuardValue( nextVisitedNodeIsChildOfSUIT ) = newValue;
+	}
+
+	void previsit( const ast::StructInstType * ) {
+		changeState_ChildOfSUIT( true );
+	}
+	void previsit( const ast::UnionInstType * ) {
+		changeState_ChildOfSUIT( true );
+	}
+	void previsit( const ast::Node * ) {
+		changeState_ChildOfSUIT( false );
+	}
+
+	const ast::TypeDecl * postvisit( const ast::TypeDecl * decl );
+	const ast::Expr * postvisit( const ast::DimensionExpr * expr );
+	const ast::Expr * postvisit( const ast::Expr * expr );
+	const ast::Expr * postvisit( const ast::TypeExpr * expr );
+};
+
+const ast::TypeDecl * TranslateDimensionCore::postvisit(
+		const ast::TypeDecl * decl ) {
+	if ( decl->kind == ast::TypeDecl::Dimension ) {
+		auto mutDecl = ast::mutate( decl );
+		mutDecl->kind = ast::TypeDecl::Dtype;
+		if ( !isReservedTysysIdOnlyName( mutDecl->name ) ) {
+			mutDecl->sized = true;
+		}
+		return mutDecl;
+	}
+	return decl;
+}
+
+// Passing values as dimension arguments:  array( float,     7 )  -> array( float, char[             7 ] )
+// Consuming dimension parameters:         size_t x =    N - 1 ;  -> size_t x =          sizeof(N) - 1   ;
+// Intertwined reality:                    array( float, N     )  -> array( float,              N        )
+//                                         array( float, N - 1 )  -> array( float, char[ sizeof(N) - 1 ] )
+// Intertwined case 1 is not just an optimization.
+// Avoiding char[sizeof(-)] is necessary to enable the call of f to bind the value of N, in:
+//   forall([N]) void f( array(float, N) & );
+//   array(float, 7) a;
+//   f(a);
+const ast::Expr * TranslateDimensionCore::postvisit(
+		const ast::DimensionExpr * expr ) {
+	// Expression `expr` is an occurrence of N in LHS of above examples.
+	// Look up the name that `expr` references.
+	// If we are in a struct body, then this reference can be to an entry of
+	// the stuct's forall list.
+	// Whether or not we are in a struct body, this reference can be to an
+	// entry of a containing function's forall list.
+	// If we are in a struct body, then the stuct's forall declarations are
+	// innermost (functions don't occur in structs).
+	// Thus, a potential struct's declaration is highest priority.
+	// A struct's forall declarations are already renamed with _generic_ suffix.
+	// Try that name variant first.
+
+	std::string useName = "__" + expr->name + "_generic_";
+	ast::TypeDecl * namedParamDecl = const_cast<ast::TypeDecl *>(
+		strict_dynamic_cast<const ast::TypeDecl *, nullptr >(
+			symtab.lookupType( useName ) ) );
+
+	if ( !namedParamDecl ) {
+		useName = expr->name;
+		namedParamDecl = const_cast<ast::TypeDecl *>( strict_dynamic_cast<const ast::TypeDecl *, nullptr >( symtab.lookupType( useName ) ) );
+	}
+
+	// Expect to find it always.
+	// A misspelled name would have been parsed as an identifier.
+	assertf( namedParamDecl, "Type-system-managed value name not found in symbol table" );
+
+	auto * refToDecl = new ast::TypeInstType( useName, namedParamDecl );
+
+	if ( visitingChildOfSUIT ) {
+		// As in postvisit( Expr * ), topmost expression needs a TypeExpr
+		// wrapper. But avoid ArrayType-Sizeof.
+		return new ast::TypeExpr( expr->location, refToDecl );
+	} else {
+		// the N occurrence is being used directly as a runtime value,
+		// if we are in a type instantiation, then the N is within a bigger value computation
+		return new ast::SizeofExpr( expr->location, refToDecl );
+	}
+}
+
+const ast::Expr * TranslateDimensionCore::postvisit(
+		const ast::Expr * expr ) {
+	// This expression is used as an argument to instantiate a type.
+	if ( visitingChildOfSUIT ) {
+		// DimensionExpr and TypeExpr should not reach here.
+		return new ast::TypeExpr( expr->location,
+			new ast::ArrayType(
+				new ast::BasicType( ast::BasicType::Char ),
+				expr,
+				ast::VariableLen,
+				ast::DynamicDim
+			)
+		);
+	}
+	return expr;
+}
+
+const ast::Expr * TranslateDimensionCore::postvisit(
+		const ast::TypeExpr * expr ) {
+	// Does nothing, except prevents matching ast::Expr (above).
+	return expr;
+}
+
+} // namespace
+
+void fillGenericParameters( ast::TranslationUnit & translationUnit ) {
+	ast::Pass<ValidateGenericParamsCore>::run( translationUnit );
+}
+
+void translateDimensionParameters( ast::TranslationUnit & translationUnit ) {
+	ast::Pass<TranslateDimensionCore>::run( translationUnit );
+}
+
+} // namespace Validate
+
+// Local Variables: //
+// tab-width: 4 //
+// mode: c++ //
+// compile-command: "make install" //
+// End: //
Index: src/Validate/GenericParameter.hpp
===================================================================
--- src/Validate/GenericParameter.hpp	(revision 365c8dcbd76a5d6cafc342a140f686a573523fea)
+++ src/Validate/GenericParameter.hpp	(revision 365c8dcbd76a5d6cafc342a140f686a573523fea)
@@ -0,0 +1,36 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2018 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// GenericParameter.hpp --
+//
+// Author           : Andrew Beach
+// Created On       : Fri Mar 21  9:55:00 2022
+// Last Modified By : Andrew Beach
+// Last Modified On : Wed Apr 13 14:45:00 2022
+// Update Count     : 0
+//
+
+#pragma once
+
+namespace ast {
+	class TranslationUnit;
+}
+
+namespace Validate {
+
+/// Perform substutions for generic parameters and fill in defaults.
+void fillGenericParameters( ast::TranslationUnit & translationUnit );
+
+/// Replace dimension generic parameters with a fixed type of that size.
+void translateDimensionParameters( ast::TranslationUnit & translationUnit );
+
+}
+
+// Local Variables: //
+// tab-width: 4 //
+// mode: c++ //
+// compile-command: "make install" //
+// End: //
Index: src/Validate/ReturnCheck.cpp
===================================================================
--- src/Validate/ReturnCheck.cpp	(revision 365c8dcbd76a5d6cafc342a140f686a573523fea)
+++ src/Validate/ReturnCheck.cpp	(revision 365c8dcbd76a5d6cafc342a140f686a573523fea)
@@ -0,0 +1,56 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2018 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// ReturnCheck.cpp -- Run simple (non-typed) checks on return statements.
+//
+// Author           : Andrew Beach
+// Created On       : Fri Mar 18 14:07:00 2022
+// Last Modified By : Andrew Beach
+// Last Modified On : Fri Mar 18 14:26:00 2022
+// Update Count     : 0
+//
+
+#include "ReturnCheck.hpp"
+
+#include "AST/Decl.hpp"
+#include "AST/Pass.hpp"
+#include "AST/Stmt.hpp"
+#include "AST/TranslationUnit.hpp"
+
+namespace Validate {
+
+namespace {
+
+struct ReturnCore : public ast::WithGuards {
+	bool inVoidFunction = false;
+
+	void previsit( const ast::FunctionDecl * decl ) {
+		GuardValue( inVoidFunction ) = (0 == decl->returns.size());
+	}
+
+	void previsit( const ast::ReturnStmt * stmt ) {
+		// The only definite error case is an empty return on a non-void
+		// functions. Everything else requires resolution. (You can have
+		// a void expression in a return statement.
+		if ( !stmt->expr && !inVoidFunction ) {
+			SemanticError( stmt, "Non-void function returns no values: " );
+		}
+	}
+};
+
+} // namespace
+
+void checkReturnStatements( ast::TranslationUnit & translationUnit ) {
+	ast::Pass<ReturnCore>::run( translationUnit );
+}
+
+} // namespace Validate
+
+// Local Variables: //
+// tab-width: 4 //
+// mode: c++ //
+// compile-command: "make install" //
+// End: //
Index: src/Validate/ReturnCheck.hpp
===================================================================
--- src/Validate/ReturnCheck.hpp	(revision 365c8dcbd76a5d6cafc342a140f686a573523fea)
+++ src/Validate/ReturnCheck.hpp	(revision 365c8dcbd76a5d6cafc342a140f686a573523fea)
@@ -0,0 +1,34 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2018 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// ReturnCheck.hpp -- Run simple (non-typed) checks on return statements.
+//
+// Author           : Andrew Beach
+// Created On       : Fri Mar 18 14:05:00 2022
+// Last Modified By : Andrew Beach
+// Last Modified On : Fri Mar 18 14:26:00 2022
+// Update Count     : 0
+//
+
+#pragma once
+
+namespace ast {
+    class TranslationUnit;
+}
+
+namespace Validate {
+
+/// Check that return statements have an expression when they must have one.
+void checkReturnStatements( ast::TranslationUnit & translationUnit );
+
+}
+
+// Local Variables: //
+// tab-width: 4 //
+// mode: c++ //
+// compile-command: "make install" //
+// End: //
+
Index: src/Validate/module.mk
===================================================================
--- src/Validate/module.mk	(revision 30d91e4132fb7ec560dd389474deafbfd0d57555)
+++ src/Validate/module.mk	(revision 365c8dcbd76a5d6cafc342a140f686a573523fea)
@@ -22,4 +22,6 @@
 	Validate/ForallPointerDecay.cpp \
 	Validate/ForallPointerDecay.hpp \
+	Validate/GenericParameter.cpp \
+	Validate/GenericParameter.hpp \
 	Validate/HandleAttributes.cc \
 	Validate/HandleAttributes.h \
@@ -28,4 +30,6 @@
 	Validate/LabelAddressFixer.cpp \
 	Validate/LabelAddressFixer.hpp \
+	Validate/ReturnCheck.cpp \
+	Validate/ReturnCheck.hpp \
 	Validate/FindSpecialDeclsNew.cpp \
 	Validate/FindSpecialDecls.cc \
Index: src/main.cc
===================================================================
--- src/main.cc	(revision 30d91e4132fb7ec560dd389474deafbfd0d57555)
+++ src/main.cc	(revision 365c8dcbd76a5d6cafc342a140f686a573523fea)
@@ -10,6 +10,6 @@
 // Created On       : Fri May 15 23:12:02 2015
 // Last Modified By : Andrew Beach
-// Last Modified On : Fri Mar 11 10:39:00 2022
-// Update Count     : 671
+// Last Modified On : Wed Apr 13 11:11:00 2022
+// Update Count     : 672
 //
 
@@ -75,4 +75,5 @@
 #include "Tuples/Tuples.h"                  // for expandMemberTuples, expan...
 #include "Validate/Autogen.hpp"             // for autogenerateRoutines
+#include "Validate/GenericParameter.hpp"    // for fillGenericParameters, tr...
 #include "Validate/FindSpecialDecls.h"      // for findGlobalDecls
 #include "Validate/ForallPointerDecay.hpp"  // for decayForallPointers
@@ -80,4 +81,5 @@
 #include "Validate/InitializerLength.hpp"   // for setLengthFromInitializer
 #include "Validate/LabelAddressFixer.hpp"   // for fixLabelAddresses
+#include "Validate/ReturnCheck.hpp"         // for checkReturnStatements
 #include "Virtual/ExpandCasts.h"            // for expandCasts
 
@@ -327,5 +329,4 @@
 		PASS( "Validate-A", SymTab::validate_A( translationUnit ) );
 		PASS( "Validate-B", SymTab::validate_B( translationUnit ) );
-		PASS( "Validate-C", SymTab::validate_C( translationUnit ) );
 
 		CodeTools::fillLocations( translationUnit );
@@ -341,4 +342,15 @@
 
 			forceFillCodeLocations( transUnit );
+
+			// Check as early as possible. Can't happen before
+			// LinkReferenceToType, observed failing when attempted
+			// before eliminateTypedef
+			PASS( "Validate Generic Parameters", Validate::fillGenericParameters( transUnit ) );
+
+			PASS( "Translate Dimensions", Validate::translateDimensionParameters( transUnit ) );
+			PASS( "Check Function Returns", Validate::checkReturnStatements( transUnit ) );
+
+			// Must happen before Autogen.
+			PASS( "Fix Return Statements", InitTweak::fixReturnStatements( transUnit ) );
 
 			PASS( "Implement Concurrent Keywords", Concurrency::implementKeywords( transUnit ) );
@@ -426,4 +438,5 @@
 			translationUnit = convert( move( transUnit ) );
 		} else {
+			PASS( "Validate-C", SymTab::validate_C( translationUnit ) );
 			PASS( "Validate-D", SymTab::validate_D( translationUnit ) );
 			PASS( "Validate-E", SymTab::validate_E( translationUnit ) );
