Index: src/CodeGen/CodeGenerator.cc
===================================================================
--- src/CodeGen/CodeGenerator.cc	(revision e04ef3a33b7695190c509b61da6fe0cfcf46b265)
+++ src/CodeGen/CodeGenerator.cc	(revision 7ff30d07fc0faa6fe08d4b36246cc54d7712881c)
@@ -26,4 +26,5 @@
 #include "SynTree/Statement.h"
 #include "SynTree/Type.h"
+#include "SynTree/Attribute.h"
 
 #include "Common/utility.h"
@@ -33,4 +34,6 @@
 #include "OperatorTable.h"
 #include "GenType.h"
+
+#include "InitTweak/InitTweak.h"
 
 using namespace std;
@@ -74,26 +77,24 @@
 	}
 
+	void CodeGenerator::genAttributes( std::list< Attribute * > & attributes ) {
+		if ( ! attributes.empty() ) {
+			output << "__attribute__ ((";
+			for ( Attribute *& attr : attributes ) {
+				if ( ! attr->empty() ) {
+					output << attr->get_name() << "(";
+					genCommaList( attr->get_parameters().begin(), attr->get_parameters().end() );
+					output << ")";
+				}
+				output << ",";
+			}
+			output << ")) ";
+		}
+	}
+
+
 	//*** Declarations
 	void CodeGenerator::visit( FunctionDecl *functionDecl ) {
-		// generalize this
-		FunctionDecl::Attribute attr = functionDecl->get_attribute();
-		switch ( attr.type ) {
-			case FunctionDecl::Attribute::Constructor:
-				output << "__attribute__ ((constructor";
-				if ( attr.priority != FunctionDecl::Attribute::Default ) {
-					output << "(" << attr.priority << ")";
-				}
-				output << ")) ";
-				break;
-			case FunctionDecl::Attribute::Destructor:
-				output << "__attribute__ ((destructor";
-				if ( attr.priority != FunctionDecl::Attribute::Default ) {
-					output << "(" << attr.priority << ")";
-				}
-				output << ")) ";
-				break;
-			default:
-				break;
-		}
+		genAttributes( functionDecl->get_attributes() );
+
 		handleStorageClass( functionDecl );
 		if ( functionDecl->get_isInline() ) {
@@ -270,4 +271,8 @@
 							UntypedExpr *newExpr = new UntypedExpr( new NameExpr( "*?" ) );
 							newExpr->get_args().push_back( *arg );
+							assert( (*arg)->get_results().size() == 1 );
+							Type * type = InitTweak::getPointerBase( (*arg)->get_results().front() );
+							assert( type );
+							newExpr->get_results().push_back( type );
 							*arg = newExpr;
 						} // if
@@ -298,8 +303,8 @@
 					if ( applicationExpr->get_args().size() == 1 ) {
 						// the expression fed into a single parameter constructor or destructor
-						// may contain side effects - output as a void expression
-						output << "((void)(";
+						// may contain side effects, so must still output this expression
+						output << "(";
 						(*arg++)->accept( *this );
-						output << ")) /* " << opInfo.inputName << " */";
+						output << ") /* " << opInfo.inputName << " */";
 					} else if ( applicationExpr->get_args().size() == 2 ) {
 						// intrinsic two parameter constructors are essentially bitwise assignment
@@ -384,8 +389,8 @@
 					if ( untypedExpr->get_args().size() == 1 ) {
 						// the expression fed into a single parameter constructor or destructor
-						// may contain side effects - output as a void expression
-						output << "((void)(";
+						// may contain side effects, so must still output this expression
+						output << "(";
 						(*arg++)->accept( *this );
-						output << ")) /* " << opInfo.inputName << " */";
+						output << ") /* " << opInfo.inputName << " */";
 					} else if ( untypedExpr->get_args().size() == 2 ) {
 						// intrinsic two parameter constructors are essentially bitwise assignment
@@ -626,13 +631,9 @@
 
 	void CodeGenerator::visit( ExprStmt *exprStmt ) {
-		// I don't see why this check is necessary.
-		// If this starts to cause problems then put it back in,
-		// with an explanation
 		assert( exprStmt );
-
-		// if ( exprStmt != 0 ) {
-		exprStmt->get_expr()->accept( *this );
-		output << ";" ;
-		// } // if
+		// cast the top-level expression to void to reduce gcc warnings.
+		Expression * expr = new CastExpr( exprStmt->get_expr() );
+		expr->accept( *this );
+		output << ";";
 	}
 
@@ -743,7 +744,7 @@
 
 	void CodeGenerator::visit( WhileStmt *whileStmt ) {
-		if ( whileStmt->get_isDoWhile() )
+		if ( whileStmt->get_isDoWhile() ) {
 			output << "do" ;
-		else {
+		} else {
 			output << "while (" ;
 			whileStmt->get_condition()->accept( *this );
@@ -769,10 +770,14 @@
 		output << "for (;";
 
-		if ( forStmt->get_condition() != 0 )
+		if ( forStmt->get_condition() != 0 ) {
 			forStmt->get_condition()->accept( *this );
+		}
 		output << ";";
 
-		if ( forStmt->get_increment() != 0 )
-			forStmt->get_increment()->accept( *this );
+		if ( forStmt->get_increment() != 0 ) {
+			// cast the top-level expression to void to reduce gcc warnings.
+			Expression * expr = new CastExpr( forStmt->get_increment() );
+			expr->accept( *this );
+		}
 		output << ") ";
 
Index: src/CodeGen/CodeGenerator.h
===================================================================
--- src/CodeGen/CodeGenerator.h	(revision e04ef3a33b7695190c509b61da6fe0cfcf46b265)
+++ src/CodeGen/CodeGenerator.h	(revision 7ff30d07fc0faa6fe08d4b36246cc54d7712881c)
@@ -5,5 +5,5 @@
 // file "LICENCE" distributed with Cforall.
 //
-// CodeGenerator.h -- 
+// CodeGenerator.h --
 //
 // Author           : Richard C. Bilson
@@ -60,5 +60,5 @@
 		virtual void visit( MemberExpr *memberExpr );
 		virtual void visit( VariableExpr *variableExpr );
-		virtual void visit( ConstantExpr *constantExpr ); 
+		virtual void visit( ConstantExpr *constantExpr );
 		virtual void visit( SizeofExpr *sizeofExpr );
 		virtual void visit( AlignofExpr *alignofExpr );
@@ -85,5 +85,7 @@
 		virtual void visit( ForStmt * );
 		virtual void visit( NullStmt * );
-		virtual void visit( DeclStmt * ); 
+		virtual void visit( DeclStmt * );
+
+		void genAttributes( std::list< Attribute * > & attributes );
 
 		template< class Iterator > void genCommaList( Iterator begin, Iterator end );
@@ -114,5 +116,5 @@
 
 	};
-	
+
 	template< class Iterator >
 	void CodeGenerator::genCommaList( Iterator begin, Iterator end ) {
@@ -125,5 +127,5 @@
 		} // for
 	}
-  
+
 	inline bool doSemicolon( Declaration* decl ) {
 		if ( FunctionDecl* func = dynamic_cast< FunctionDecl* >( decl ) ) {
