Index: src/GenPoly/Lvalue.cc
===================================================================
--- src/GenPoly/Lvalue.cc	(revision 6b8c4a8c388b7ab43ded2b96957e296c130305ab)
+++ src/GenPoly/Lvalue.cc	(revision d286cf68892dfb231fb65f0127f47f3d593ac9f1)
@@ -146,16 +146,14 @@
 
 	namespace {
-		// true for intrinsic function calls that return a reference
+		// true for intrinsic function calls that return an lvalue in C
 		bool isIntrinsicReference( Expression * expr ) {
+			// known intrinsic-reference prelude functions
+			static std::set<std::string> lvalueFunctions = { "*?", "?[?]" };
 			if ( UntypedExpr * untyped = dynamic_cast< UntypedExpr * >( expr ) ) {
 				std::string fname = InitTweak::getFunctionName( untyped );
-				// known intrinsic-reference prelude functions
-				return fname == "*?" || fname == "?[?]";
+				return lvalueFunctions.count(fname);
 			} else if ( ApplicationExpr * appExpr = dynamic_cast< ApplicationExpr * > ( expr ) ) {
 				if ( DeclarationWithType * func = InitTweak::getFunction( appExpr ) ) {
-					// use type of return variable rather than expr result type, since it may have been changed to a pointer type
-					FunctionType * ftype = GenPoly::getFunctionType( func->get_type() );
-					Type * ret = ftype->returnVals.empty() ? nullptr : ftype->returnVals.front()->get_type();
-					return func->linkage == LinkageSpec::Intrinsic && dynamic_cast<ReferenceType *>( ret );
+					return func->linkage == LinkageSpec::Intrinsic && lvalueFunctions.count(func->name);
 				}
 			}
@@ -212,5 +210,5 @@
 						// TODO: it's likely that the second condition should be ... && ! isIntrinsicReference( arg ), but this requires investigation.
 
-						if ( function->get_linkage() != LinkageSpec::Intrinsic && isIntrinsicReference( arg ) ) {
+						if ( function->linkage != LinkageSpec::Intrinsic && isIntrinsicReference( arg ) ) {
 							// needed for definition of prelude functions, etc.
 							// if argument is dereference or array subscript, the result isn't REALLY a reference, but non-intrinsic functions expect a reference: take address
@@ -228,5 +226,5 @@
 							arg = new AddressExpr( arg );
 						// } else if ( function->get_linkage() == LinkageSpec::Intrinsic && InitTweak::getPointerBase( arg->result ) ) {
-						} else if ( function->get_linkage() == LinkageSpec::Intrinsic && arg->result->referenceDepth() != 0 ) {
+						} else if ( function->linkage == LinkageSpec::Intrinsic && arg->result->referenceDepth() != 0 ) {
 							// argument is a 'real' reference, but function expects a C lvalue: add a dereference to the reference-typed argument
 							PRINT(
