From dba741894b05facaf6e06184da4125a17cf7deac Mon Sep 17 00:00:00 2001
From: Erwan Jahier <jahier@imag.fr>
Date: Tue, 19 Aug 2008 16:05:14 +0200
Subject: [PATCH] Fix a  bug in the previous  change, where an  internal clock
 variable was used in  the local variables generated to  split expressions
 into atomic expressions.

Indeed,  when  such an  intermediary  expression  is  inferred to  be
variable, it is  ok to consider that  it is on the base  clock. And I
was missing such a case.
---
 src/evalClock.ml      |  5 +++--
 src/licDump.ml        |  7 ++-----
 src/test/test.res.exp | 12 ++++++------
 3 files changed, 11 insertions(+), 13 deletions(-)

diff --git a/src/evalClock.ml b/src/evalClock.ml
index 5f9d6155..9dd9ef59 100644
--- a/src/evalClock.ml
+++ b/src/evalClock.ml
@@ -1,4 +1,4 @@
-(** Time-stamp: <modified the 19/08/2008 (at 15:27) by Erwan Jahier> *)
+(** Time-stamp: <modified the 19/08/2008 (at 15:55) by Erwan Jahier> *)
  
   
 open Predef
@@ -201,7 +201,8 @@ let (val_exp_eff : val_exp_eff -> clock_eff list) =
         (* Some expressions migth be infered to be a variable clock
            (e.g., constants). In that case, it is ok to consider that such
            expression are on the base clock.*)
-        | ClockVar _ -> BaseEff
+        | ClockVar _ 
+        | On(_,ClockVar _) -> BaseEff
         | x -> x
       in
         List.map var_clock_to_base res
diff --git a/src/licDump.ml b/src/licDump.ml
index 21e4077a..e77b0661 100644
--- a/src/licDump.ml
+++ b/src/licDump.ml
@@ -1,4 +1,4 @@
-(** Time-stamp: <modified the 19/08/2008 (at 15:18) by Erwan Jahier> *)
+(** Time-stamp: <modified the 19/08/2008 (at 15:58) by Erwan Jahier> *)
 
 open CompiledData
 open Printf
@@ -457,10 +457,7 @@ and string_of_clock (ck : clock_eff) =
     | BaseEff -> ""
     | On(_,BaseEff) -> ""
     | On(v,On(id,_)) ->" when " ^ (Ident.to_string id)
-    | On(v,ClockVar i) -> " when _clock_var_" ^ (string_of_int i)
-    | ClockVar i -> 
-(*          "_clock_var_" ^ (string_of_int i) *)
-         assert false
+    | _ -> assert false
 
 
 and string_of_clock_list cl = 
diff --git a/src/test/test.res.exp b/src/test/test.res.exp
index 42a81a0c..af0f8e85 100644
--- a/src/test/test.res.exp
+++ b/src/test/test.res.exp
@@ -9739,7 +9739,7 @@ returns (
 	clock4_x:bool;
 	clock4_y:bool when clock4_x);
 
-*** oops: an internal error occurred in file evalClock.ml, line 273, column 31
+*** oops: an internal error occurred in file evalClock.ml, line 274, column 31
 *** when compiling lustre program should_work/clock/when_not.lus
 
 ----------------------------------------------------------------------
@@ -10377,9 +10377,9 @@ tel
 -- end of node alias::aliasPredefNot
 node alias::alias(a:bool) returns (b:bool; c:int);
 var
-   _v3:A_int_3 when _clock_var_1;
+   _v3:A_int_3;
    _v1:A_int_3;
-   _v2:A_int_3 when _clock_var_1;
+   _v2:A_int_3;
 let
    b = (alias::aliasPredefNot(a));
    c = (alias::aliasGivenNode(0, _v3));
@@ -11400,7 +11400,7 @@ tel
 -- end of node ex::id
 node ex::trueNode(x:bool) returns (y:bool);
 var
-   _v1:bool when _clock_var_1;
+   _v1:bool;
 let
    y = (x or _v1);
    _v1 = (ex::id(true, false));
@@ -17998,8 +17998,8 @@ var
    _v2:real;
    _v4:real;
    _v10:real;
-   _v8:real when _clock_var_5;
-   _v7:real when _clock_var_5;
+   _v8:real;
+   _v7:real;
    _v6:real;
    _v9:real;
    _v13:real;
-- 
GitLab