From df9ce788ecba7963605a17d86c5acf5db8e77f96 Mon Sep 17 00:00:00 2001
From: stepan <stepan.sindelar@oracle.com>
Date: Mon, 25 Sep 2017 18:19:59 +0200
Subject: [PATCH] Fix NFI variables init + fail fast on unknown variables

---
 .../fficall/src/truffle_nfi/variables.c           | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/com.oracle.truffle.r.native/fficall/src/truffle_nfi/variables.c b/com.oracle.truffle.r.native/fficall/src/truffle_nfi/variables.c
index bec429e25e..858688a9b2 100644
--- a/com.oracle.truffle.r.native/fficall/src/truffle_nfi/variables.c
+++ b/com.oracle.truffle.r.native/fficall/src/truffle_nfi/variables.c
@@ -274,15 +274,21 @@ SEXP FASTR_R_SrcfileSymbol() {
 void Call_initvar_double(int index, double value) {
 	switch (index) {
     case R_NaN_x: R_NaN = value; break;
+    case R_PosInf_x: R_PosInf = value; break;
+    case R_NegInf_x: R_NegInf = value; break;
+    case R_NaReal_x: R_NaReal = value; break;
+    default:
+        printf("Call_initvar_double: unimplemented index %d\n", index);
+        exit(1);
 	}
 }
 
 void Call_initvar_int(int index, int value) {
 	switch (index) {
     case R_NaInt_x: R_NaInt = value; break;
-    case R_PosInf_x: R_PosInf = value; break;
-    case R_NegInf_x: R_NegInf = value; break;
-    case R_NaReal_x: R_NaReal = value; break;
+    default:
+        printf("Call_initvar_int: unimplemented index %d\n", index);
+        exit(1);
 	}
 }
 
@@ -297,6 +303,9 @@ void Call_initvar_string(int index, char *value) {
 	switch (index) {
     case R_Home_x: R_Home_static = copystring(value); break;
     case R_TempDir_x: R_TempDir_static = copystring(value); break;
+    default:
+        printf("Call_initvar_string: unimplemented index %d\n", index);
+        exit(1);
 	}
 }
 
-- 
GitLab