From 482bfbc2c2e54813bdd6fa1d436d2bb7168a5005 Mon Sep 17 00:00:00 2001
From: Aron Simon <aron.simon@sigmatechnology.se>
Date: Tue, 14 Aug 2018 13:36:43 +0200
Subject: [PATCH] fix: checkstate marked as non-deterministic function invoking
 during snapshots

Change-Id: I2f98fe239bd27dbf1cdadbc8745c4ef099697526
Signed-off-by: Aron Simon <aron.simon@sigmatechnology.se>
---
 compiler2/Value.cc                                        | 2 +-
 function_test/Semantic_Analyser/TTCN3_SA_9_TD.script      | 8 ++++----
 .../InvokingFunctionFromSpecificPlaces_SW.ttcn            | 6 +++---
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/compiler2/Value.cc b/compiler2/Value.cc
index b7350369f..0def1d2a4 100644
--- a/compiler2/Value.cc
+++ b/compiler2/Value.cc
@@ -630,7 +630,7 @@ namespace Common {
             break;
           case OPTYPE_CHECKSTATE_ANY: // [r1] v2: port or any
           case OPTYPE_CHECKSTATE_ALL: // [r1] v2: port or all
-            u.expr.v2->chk_expr_immutability();
+            warning("State of port(s) may change during the actual snapshot.");
             break;
           case OPTYPE_HOSTID: // [v1]
             if (u.expr.v1) u.expr.v1->chk_expr_immutability();
diff --git a/function_test/Semantic_Analyser/TTCN3_SA_9_TD.script b/function_test/Semantic_Analyser/TTCN3_SA_9_TD.script
index 0fd001eb0..0471e9c12 100644
--- a/function_test/Semantic_Analyser/TTCN3_SA_9_TD.script
+++ b/function_test/Semantic_Analyser/TTCN3_SA_9_TD.script
@@ -1333,16 +1333,16 @@ module M {
 	testcase T() runs on C {
 		timer t := 5.0; t.start;
 		alt {
-			[(p.checkstate("Connected"))] t.timeout {}			// OK?
-			[(any port.checkstate("Connected"))] t.timeout {}	// OK?
+			[(p.checkstate("Connected"))] t.timeout {}			// NOT OK
+			[(any port.checkstate("Connected"))] t.timeout {}	// NOT OK
 			[(p.checkstate(FS()))] t.timeout {}					// NOT OK
 			[(any port.checkstate(FS()))] t.timeout {}			// NOT OK
 		}
 	}
 }
 <END_MODULE>
-<RESULT IF_FAIL COUNT 2>
-(?im)\bwarning\b.+?\bFunction invocation\b.+?\bmay change the actual snapshot\b
+<RESULT IF_FAIL COUNT 4>
+(?im)\bwarning\b.+?\bstate of port\b.+?\bmay change during the actual snapshot\b
 <END_RESULT>
 <END_TC>
 :exmp.
diff --git a/function_test/Semantic_Analyser/invoking_function_from_specific_places/InvokingFunctionFromSpecificPlaces_SW.ttcn b/function_test/Semantic_Analyser/invoking_function_from_specific_places/InvokingFunctionFromSpecificPlaces_SW.ttcn
index e12cad11c..e593aea9d 100644
--- a/function_test/Semantic_Analyser/invoking_function_from_specific_places/InvokingFunctionFromSpecificPlaces_SW.ttcn
+++ b/function_test/Semantic_Analyser/invoking_function_from_specific_places/InvokingFunctionFromSpecificPlaces_SW.ttcn
@@ -149,10 +149,10 @@ module InvokingFunctionFromSpecificPlaces_SW { //^In TTCN-3 module//
       [t.running] t.timeout {} //^In guard expression// //^warning\: State of timer//
 
       /* OPTYPE_CHECKSTATE_ANY */
-      [(any port.checkstate("Connected"))] t.timeout {}
-      [(any port.checkstate(fs()))] t.timeout {} //^In guard expression//  //^warning\: Function invocation//
+      [(any port.checkstate("Connected"))] t.timeout {} //^In guard expression//  //^warning\: State of port//
+      [(any port.checkstate(fs()))] t.timeout {} //^In guard expression//  //^warning\: State of port//
       /* OPTYPE_CHECKSTATE_ALL */ 
-      [(all port.checkstate(fs()))] t.timeout {} //^In guard expression//  //^warning\: Function invocation// 
+      [(all port.checkstate(fs()))] t.timeout {} //^In guard expression//  //^warning\: State of port// 
 
       /* OPTYPE_HOSTID */
       [hostid() == ""] t.timeout {}
-- 
GitLab