Index: src/GenPoly/Box.cc
===================================================================
--- src/GenPoly/Box.cc	(revision aaeacf4b17e26df880b846210c264be0d6cc771b)
+++ src/GenPoly/Box.cc	(revision 2d80111cda56c1eaa64c85ead71201dfe6b1b5b8)
@@ -725,5 +725,5 @@
 			if ( ! needsBoxing( param, arg->result, exprTyVars, env ) ) return;
 
-			if ( arg->result->get_lvalue() ) {
+			if ( arg->get_lvalue() ) {
 				// argument expression may be CFA lvalue, but not C lvalue -- apply generalizedLvalue transformations.
 				// if ( VariableExpr * varExpr = dynamic_cast< VariableExpr * >( arg ) ) {
Index: src/GenPoly/Lvalue.cc
===================================================================
--- src/GenPoly/Lvalue.cc	(revision aaeacf4b17e26df880b846210c264be0d6cc771b)
+++ src/GenPoly/Lvalue.cc	(revision 2d80111cda56c1eaa64c85ead71201dfe6b1b5b8)
@@ -363,5 +363,5 @@
 			int diff = depth1 - depth2;
 
-			if ( diff > 0 && ! srcType->get_lvalue() ) {
+			if ( diff > 0 && ! castExpr->arg->get_lvalue() ) {
 				// rvalue to reference conversion -- introduce temporary
 				// know that reference depth of cast argument is 0, need to introduce n temporaries for reference depth of n, e.g.
@@ -407,5 +407,5 @@
 					ret = new AddressExpr( ret );
 				}
-				if ( srcType->get_lvalue() && ! ResolvExpr::typesCompatible( srcType, strict_dynamic_cast<ReferenceType *>( destType )->base, SymTab::Indexer() ) ) {
+				if ( castExpr->arg->get_lvalue() && ! ResolvExpr::typesCompatible( srcType, strict_dynamic_cast<ReferenceType *>( destType )->base, SymTab::Indexer() ) ) {
 					// must keep cast if cast-to type is different from the actual type
 					castExpr->arg = ret;
