Index: src/CodeGen/CodeGenerator.cc
===================================================================
--- src/CodeGen/CodeGenerator.cc	(revision 10a7775d07dcc9d19f88786e6be9a198720e9cac)
+++ src/CodeGen/CodeGenerator.cc	(revision 321a2481aec2e4a3da980c519cddd0b6e8fbf3ea)
@@ -638,13 +638,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 << ";";
 	}
 
@@ -755,7 +751,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 );
@@ -781,10 +777,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 << ") ";
 
