Index: src/AST/Label.hpp
===================================================================
--- src/AST/Label.hpp	(revision 5c231c17eaf89139bc7b23f158a6e0f3468ef04d)
+++ src/AST/Label.hpp	(revision 3f681b19ad69aad53c354e0cd700eb632656069e)
@@ -34,5 +34,5 @@
 	std::vector< ptr<Attribute> > attributes;
 
-	Label( CodeLocation loc, const std::string& name = "",
+	Label( const CodeLocation& loc, const std::string& name = "",
 		std::vector<ptr<Attribute>> && attrs = std::vector<ptr<Attribute>>{} )
 	: location( loc ), name( name ), attributes( attrs ) {}
Index: src/AST/Node.hpp
===================================================================
--- src/AST/Node.hpp	(revision 5c231c17eaf89139bc7b23f158a6e0f3468ef04d)
+++ src/AST/Node.hpp	(revision 3f681b19ad69aad53c354e0cd700eb632656069e)
@@ -51,4 +51,7 @@
 	bool isManaged() const { return strong_count > 0; }
 	bool isReferenced() const { return weak_count > 0; }
+	bool isStable() const {
+		return (1 == strong_count || (1 < strong_count && 0 == weak_count));
+	}
 
 private:
Index: src/AST/Pass.proto.hpp
===================================================================
--- src/AST/Pass.proto.hpp	(revision 5c231c17eaf89139bc7b23f158a6e0f3468ef04d)
+++ src/AST/Pass.proto.hpp	(revision 3f681b19ad69aad53c354e0cd700eb632656069e)
@@ -131,6 +131,6 @@
 	template< typename node_t >
 	struct result1 {
-		bool differs;
-		const node_t * value;
+		bool differs = false;
+		const node_t * value = nullptr;
 
 		template< typename object_t, typename super_t, typename field_t >
@@ -151,5 +151,5 @@
 		};
 
-		bool differs;
+		bool differs = false;
 		container_t< delta > values;
 
@@ -167,5 +167,5 @@
 	template< template<class...> class container_t, typename node_t >
 	struct resultN {
-		bool differs;
+		bool differs = false;
 		container_t<ptr<node_t>> values;
 
Index: src/AST/Util.cpp
===================================================================
--- src/AST/Util.cpp	(revision 5c231c17eaf89139bc7b23f158a6e0f3468ef04d)
+++ src/AST/Util.cpp	(revision 3f681b19ad69aad53c354e0cd700eb632656069e)
@@ -5,11 +5,11 @@
 // file "LICENCE" distributed with Cforall.
 //
-// Util.hpp -- General utilities for working with the AST.
+// Util.cpp -- General utilities for working with the AST.
 //
 // Author           : Andrew Beach
 // Created On       : Wed Jan 19  9:46:00 2022
 // Last Modified By : Andrew Beach
-// Last Modified On : Fri Mar 11 18:07:00 2022
-// Update Count     : 1
+// Last Modified On : Wed May  4 15:50:00 2022
+// Update Count     : 2
 //
 
@@ -46,9 +46,34 @@
 
 /// Check that every note that can has a set CodeLocation.
-struct SetCodeLocationsCore {
-	void previsit( const ParseNode * node ) {
-		assert( node->location.isSet() );
+void isCodeLocationSet( const ParseNode * node ) {
+	assert( node->location.isSet() );
+}
+
+/// Make sure the reference counts are in a valid combination.
+void isStable( const Node * node ) {
+	assert( node->isStable() );
+}
+
+/// Check that a FunctionDecl is synchronized with it's FunctionType.
+void functionDeclMatchesType( const FunctionDecl * decl ) {
+	// The type is a cache of sorts, if it is missing that is only a
+	// problem if isTypeFixed is set.
+	if ( decl->isTypeFixed ) {
+		assert( decl->type );
+	} else if ( !decl->type ) {
+		return;
 	}
-};
+
+	const FunctionType * type = decl->type;
+
+	// Check that `type->forall` corresponds with `decl->type_params`.
+	assert( type->forall.size() == decl->type_params.size() );
+	// Check that `type->assertions` corresponds with `decl->assertions`.
+	assert( type->assertions.size() == decl->assertions.size() );
+	// Check that `type->params` corresponds with `decl->params`.
+	assert( type->params.size() == decl->params.size() );
+	// Check that `type->returns` corresponds with `decl->returns`.
+	assert( type->returns.size() == decl->returns.size() );
+}
 
 struct InvariantCore {
@@ -56,13 +81,18 @@
 	// None of the passes should make changes so ordering doesn't matter.
 	NoStrongCyclesCore no_strong_cycles;
-	SetCodeLocationsCore set_code_locations;
 
 	void previsit( const Node * node ) {
 		no_strong_cycles.previsit( node );
+		isStable( node );
 	}
 
 	void previsit( const ParseNode * node ) {
-		no_strong_cycles.previsit( node );
-		set_code_locations.previsit( node );
+		previsit( (const Node *)node );
+		isCodeLocationSet( node );
+	}
+
+	void previsit( const FunctionDecl * node ) {
+		previsit( (const ParseNode *)node );
+		functionDeclMatchesType( node );
 	}
 
Index: src/ControlStruct/MultiLevelExit.cpp
===================================================================
--- src/ControlStruct/MultiLevelExit.cpp	(revision 5c231c17eaf89139bc7b23f158a6e0f3468ef04d)
+++ src/ControlStruct/MultiLevelExit.cpp	(revision 3f681b19ad69aad53c354e0cd700eb632656069e)
@@ -18,4 +18,5 @@
 #include "AST/Pass.hpp"
 #include "AST/Stmt.hpp"
+#include "Common/CodeLocationTools.hpp"
 #include "LabelGeneratorNew.hpp"
 
@@ -618,5 +619,7 @@
 	Pass<MultiLevelExitCore> visitor( labelTable );
 	const CompoundStmt * ret = stmt->accept( visitor );
-	return ret;
+	// There are some unset code locations slipping in, possibly by Labels.
+	const Node * node = localFillCodeLocations( ret->location, ret );
+	return strict_dynamic_cast<const CompoundStmt *>( node );
 }
 } // namespace ControlStruct
