about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/libexpr/eval.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc
index 2087c7c43ffb..b8c623b1a444 100644
--- a/src/libexpr/eval.cc
+++ b/src/libexpr/eval.cc
@@ -779,8 +779,10 @@ void ExprLambda::eval(EvalState & state, Env & env, Value & v)
 
 void ExprApp::eval(EvalState & state, Env & env, Value & v)
 {
-    e1->eval(state, env, v);
-    state.callFunction(v, *(e2->maybeThunk(state, env)), v);
+    /* FIXME: vFun prevents GCC from doing tail call optimisation. */
+    Value vFun;
+    e1->eval(state, env, vFun);
+    state.callFunction(vFun, *(e2->maybeThunk(state, env)), v);
 }