From 244b252de2d9002b9e87972eb28532fea2fedcad Mon Sep 17 00:00:00 2001 From: Erwan Jahier <jahier@imag.fr> Date: Thu, 9 Oct 2014 11:31:47 +0200 Subject: [PATCH] -ec: fix bug a introduced 8 commits ago More precisely, it was introduced here ea40dfa08b7ca152fa18694113b7ad4629b06f0f when addind the -enc option. Indeed, in -ec, since them I've decided to only output the main node. Hence when no main is specified, one was taken at random. But it the chosen nide is a predef one, no code is generated ! To fix this, I now chose a user def node. --- src/licPrg.ml | 12 ++++++--- src/licPrg.mli | 4 ++- src/lv6version.ml | 4 +-- test/lus2lic.sum | 69 ++++++++++++++++++++++++++--------------------- test/lus2lic.time | 14 +++++----- 5 files changed, 58 insertions(+), 45 deletions(-) diff --git a/src/licPrg.ml b/src/licPrg.ml index 3c76169a..745ce883 100644 --- a/src/licPrg.ml +++ b/src/licPrg.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 02/10/2014 (at 14:27) by Erwan Jahier> *) +(* Time-stamp: <modified the 09/10/2014 (at 09:56) by Erwan Jahier> *) module ItemKeyMap = struct include Map.Make ( @@ -89,10 +89,14 @@ let list_nodes t = fold_nodes (fun k e acc -> (k,e)::acc) t [] let choose_node t = (* since ocaml 3.12.0 only... NodeKeyMap.choose *) - match list_nodes t with - | n::_ -> Some n + let rec aux = function | [] -> None - + | (nk,ne)::l -> + match ne.Lic.def_eff with + | Lic.BodyLic _ -> Some(nk,ne) + | _ -> aux l + in + aux (list_nodes t) let iter_consts (f: Lic.item_key -> Lic.const -> unit) (this:t) : unit = ItemKeyMap.iter f this.consts diff --git a/src/licPrg.mli b/src/licPrg.mli index 1fcf18eb..14976dab 100644 --- a/src/licPrg.mli +++ b/src/licPrg.mli @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 02/10/2014 (at 14:27) by Erwan Jahier> *) +(* Time-stamp: <modified the 09/10/2014 (at 09:51) by Erwan Jahier> *) (** The data structure resulting from the compilation process *) @@ -51,6 +51,8 @@ val find_type : t -> Lic.item_key -> Lic.type_ option val find_const : t -> Lic.item_key -> Lic.const option val find_node : t -> Lic.node_key -> Lic.node_exp option val node_exists: t -> Lic.node_key -> bool + +(** choose a user node *) val choose_node : t -> (Lic.node_key * Lic.node_exp) option val find_var : Ident.t -> Lic.node_exp -> Lic.var_info option diff --git a/src/lv6version.ml b/src/lv6version.ml index 366ebb23..46e704dd 100644 --- a/src/lv6version.ml +++ b/src/lv6version.ml @@ -1,7 +1,7 @@ (** Automatically generated from Makefile *) let tool = "lus2lic" let branch = "(no" -let commit = "535" -let sha_1 = "55efeadeedd3a8c7a3600eb47d978b0d078ecc8a" +let commit = "536" +let sha_1 = "6c4f5c6abdf19fe5558e0caed3388f80ed4f7cfb" let str = (branch ^ "." ^ commit ^ " (" ^ sha_1 ^ ")") let maintainer = "jahier@imag.fr" diff --git a/test/lus2lic.sum b/test/lus2lic.sum index 18b1b259..559dfa27 100644 --- a/test/lus2lic.sum +++ b/test/lus2lic.sum @@ -1,5 +1,5 @@ ==> lus2lic0.sum <== -Test Run By jahier on Thu Oct 9 09:38:05 +Test Run By jahier on Thu Oct 9 10:16:53 Native configuration is x86_64-unknown-linux-gnu === lus2lic0 tests === @@ -63,7 +63,7 @@ XFAIL: Test bad programs (assert): test_lus2lic_no_node should_fail/assert/lecte XFAIL: Test bad programs (assert): test_lus2lic_no_node should_fail/assert/s.lus ==> lus2lic1.sum <== -Test Run By jahier on Thu Oct 9 09:38:03 +Test Run By jahier on Thu Oct 9 10:16:55 Native configuration is x86_64-unknown-linux-gnu === lus2lic1 tests === @@ -397,7 +397,7 @@ PASS: gcc -o multipar.exec multipar_multipar.c multipar_multipar_loop.c PASS: /home/jahier/lus2lic/test/../utils/compare_exec_and_2c multipar.lus {} ==> lus2lic2.sum <== -Test Run By jahier on Thu Oct 9 09:38:09 +Test Run By jahier on Thu Oct 9 10:16:57 Native configuration is x86_64-unknown-linux-gnu === lus2lic2 tests === @@ -727,7 +727,7 @@ PASS: gcc -o zzz2.exec zzz2_zzz2.c zzz2_zzz2_loop.c PASS: /home/jahier/lus2lic/test/../utils/compare_exec_and_2c zzz2.lus {} ==> lus2lic3.sum <== -Test Run By jahier on Thu Oct 9 09:38:07 +Test Run By jahier on Thu Oct 9 10:17:01 Native configuration is x86_64-unknown-linux-gnu === lus2lic3 tests === @@ -739,31 +739,38 @@ Running target unix Running ./lus2lic.tests/test3.exp ... PASS: ./lus2lic {-o COUNTER.lic COUNTER.lus} PASS: ./lus2lic {-ec -o COUNTER.ec COUNTER.lus} -FAIL: Try ec2c on the result: ./myec2c {-o COUNTER.c COUNTER.ec} +PASS: ./myec2c {-o COUNTER.c COUNTER.ec} +PASS: /home/jahier/lus2lic/test/../utils/test_lus2lic_no_node COUNTER.lus {} PASS: ./lus2lic {-o CURRENT.lic CURRENT.lus} PASS: ./lus2lic {-ec -o CURRENT.ec CURRENT.lus} -FAIL: Try ec2c on the result: ./myec2c {-o CURRENT.c CURRENT.ec} +PASS: ./myec2c {-o CURRENT.c CURRENT.ec} +PASS: /home/jahier/lus2lic/test/../utils/test_lus2lic_no_node CURRENT.lus {} PASS: ./lus2lic {-o Condact.lic Condact.lus} PASS: ./lus2lic {-ec -o Condact.ec Condact.lus} PASS: ./myec2c {-o Condact.c Condact.ec} PASS: ./lus2lic {-o EDGE.lic EDGE.lus} PASS: ./lus2lic {-ec -o EDGE.ec EDGE.lus} -FAIL: Try ec2c on the result: ./myec2c {-o EDGE.c EDGE.ec} +PASS: ./myec2c {-o EDGE.c EDGE.ec} +PASS: /home/jahier/lus2lic/test/../utils/test_lus2lic_no_node EDGE.lus {} PASS: ./lus2lic {-o ELMU.lic ELMU.lus} PASS: ./lus2lic {-ec -o ELMU.ec ELMU.lus} -FAIL: Try ec2c on the result: ./myec2c {-o ELMU.c ELMU.ec} +PASS: ./myec2c {-o ELMU.c ELMU.ec} PASS: ./lus2lic {-o FALLING_EDGE.lic FALLING_EDGE.lus} PASS: ./lus2lic {-ec -o FALLING_EDGE.ec FALLING_EDGE.lus} -FAIL: Try ec2c on the result: ./myec2c {-o FALLING_EDGE.c FALLING_EDGE.ec} +PASS: ./myec2c {-o FALLING_EDGE.c FALLING_EDGE.ec} +PASS: /home/jahier/lus2lic/test/../utils/test_lus2lic_no_node FALLING_EDGE.lus {} PASS: ./lus2lic {-o FillFollowedByRed.lic FillFollowedByRed.lus} PASS: ./lus2lic {-ec -o FillFollowedByRed.ec FillFollowedByRed.lus} -FAIL: Try ec2c on the result: ./myec2c {-o FillFollowedByRed.c FillFollowedByRed.ec} +PASS: ./myec2c {-o FillFollowedByRed.c FillFollowedByRed.ec} +PASS: /home/jahier/lus2lic/test/../utils/test_lus2lic_no_node FillFollowedByRed.lus {} PASS: ./lus2lic {-o Gyroscope.lic Gyroscope.lus} PASS: ./lus2lic {-ec -o Gyroscope.ec Gyroscope.lus} -FAIL: Try ec2c on the result: ./myec2c {-o Gyroscope.c Gyroscope.ec} +PASS: ./myec2c {-o Gyroscope.c Gyroscope.ec} +FAIL: Try to compare lus2lic -exec and ecexe: /home/jahier/lus2lic/test/../utils/test_lus2lic_no_node Gyroscope.lus {} PASS: ./lus2lic {-o Gyroscope2.lic Gyroscope2.lus} PASS: ./lus2lic {-ec -o Gyroscope2.ec Gyroscope2.lus} -FAIL: Try ec2c on the result: ./myec2c {-o Gyroscope2.c Gyroscope2.ec} +PASS: ./myec2c {-o Gyroscope2.c Gyroscope2.ec} +FAIL: Try to compare lus2lic -exec and ecexe: /home/jahier/lus2lic/test/../utils/test_lus2lic_no_node Gyroscope2.lus {} PASS: ./lus2lic {-o Int.lic Int.lus} PASS: ./lus2lic {-ec -o Int.ec Int.lus} PASS: ./myec2c {-o Int.c Int.ec} @@ -797,7 +804,7 @@ PASS: ./myec2c {-o alias.c alias.ec} PASS: /home/jahier/lus2lic/test/../utils/test_lus2lic_no_node alias.lus {} PASS: ./lus2lic {-o arbitre.lic arbitre.lus} PASS: ./lus2lic {-ec -o arbitre.ec arbitre.lus} -FAIL: Try ec2c on the result: ./myec2c {-o arbitre.c arbitre.ec} +PASS: ./myec2c {-o arbitre.c arbitre.ec} PASS: ./lus2lic {-o argos.lic argos.lus} PASS: ./lus2lic {-ec -o argos.ec argos.lus} PASS: ./myec2c {-o argos.c argos.ec} @@ -816,7 +823,7 @@ PASS: ./myec2c {-o arrays.c arrays.ec} PASS: /home/jahier/lus2lic/test/../utils/test_lus2lic_no_node arrays.lus {} PASS: ./lus2lic {-o asservi.lic asservi.lus} PASS: ./lus2lic {-ec -o asservi.ec asservi.lus} -FAIL: Try ec2c on the result: ./myec2c {-o asservi.c asservi.ec} +PASS: ./myec2c {-o asservi.c asservi.ec} PASS: ./lus2lic {-o bad_call03.lic bad_call03.lus} PASS: ./lus2lic {-ec -o bad_call03.ec bad_call03.lus} PASS: ./myec2c {-o bad_call03.c bad_call03.ec} @@ -852,7 +859,7 @@ PASS: ./myec2c {-o calculs_max.c calculs_max.ec} PASS: /home/jahier/lus2lic/test/../utils/test_lus2lic_no_node calculs_max.lus {} PASS: ./lus2lic {-o call.lic call.lus} PASS: ./lus2lic {-ec -o call.ec call.lus} -FAIL: Try ec2c on the result: ./myec2c {-o call.c call.ec} +PASS: ./myec2c {-o call.c call.ec} PASS: ./lus2lic {-o call01.lic call01.lus} PASS: ./lus2lic {-ec -o call01.ec call01.lus} PASS: ./myec2c {-o call01.c call01.ec} @@ -869,7 +876,7 @@ PASS: ./myec2c {-o call04.c call04.ec} PASS: /home/jahier/lus2lic/test/../utils/test_lus2lic_no_node call04.lus {} PASS: ./lus2lic {-o call05.lic call05.lus} PASS: ./lus2lic {-ec -o call05.ec call05.lus} -FAIL: Try ec2c on the result: ./myec2c {-o call05.c call05.ec} +PASS: ./myec2c {-o call05.c call05.ec} PASS: ./lus2lic {-o call06.lic call06.lus} PASS: ./lus2lic {-ec -o call06.ec call06.lus} PASS: ./myec2c {-o call06.c call06.ec} @@ -898,7 +905,7 @@ PASS: ./myec2c {-o ck5.c ck5.ec} PASS: /home/jahier/lus2lic/test/../utils/test_lus2lic_no_node ck5.lus {} PASS: ./lus2lic {-o ck6.lic ck6.lus} PASS: ./lus2lic {-ec -o ck6.ec ck6.lus} -FAIL: Try ec2c on the result: ./myec2c {-o ck6.c ck6.ec} +PASS: ./myec2c {-o ck6.c ck6.ec} PASS: ./lus2lic {-o ck7.lic ck7.lus} PASS: ./lus2lic {-ec -o ck7.ec ck7.lus} PASS: ./myec2c {-o ck7.c ck7.ec} @@ -956,13 +963,13 @@ PASS: ./myec2c {-o deSimone.c deSimone.ec} PASS: /home/jahier/lus2lic/test/../utils/test_lus2lic_no_node deSimone.lus {} PASS: ./lus2lic {-o decl.lic decl.lus} PASS: ./lus2lic {-ec -o decl.ec decl.lus} -FAIL: Try ec2c on the result: ./myec2c {-o decl.c decl.ec} +PASS: ./myec2c {-o decl.c decl.ec} PASS: ./lus2lic {-o declaration.lic declaration.lus} PASS: ./lus2lic {-ec -o declaration.ec declaration.lus} PASS: ./myec2c {-o declaration.c declaration.ec} PASS: ./lus2lic {-o deconne.lic deconne.lus} PASS: ./lus2lic {-ec -o deconne.ec deconne.lus} -FAIL: Try ec2c on the result: ./myec2c {-o deconne.c deconne.ec} +PASS: ./myec2c {-o deconne.c deconne.ec} PASS: ./lus2lic {-o dep.lic dep.lus} PASS: ./lus2lic {-ec -o dep.ec dep.lus} PASS: ./myec2c {-o dep.c dep.ec} @@ -1070,7 +1077,7 @@ PASS: ./myec2c {-o lucky.c lucky.ec} PASS: /home/jahier/lus2lic/test/../utils/test_lus2lic_no_node lucky.lus {} PASS: ./lus2lic {-o lustre.lic lustre.lus} PASS: ./lus2lic {-ec -o lustre.ec lustre.lus} -FAIL: Try ec2c on the result: ./myec2c {-o lustre.c lustre.ec} +PASS: ./myec2c {-o lustre.c lustre.ec} PASS: ./lus2lic {-o lustre_test1_ok.lic lustre_test1_ok.lus} PASS: ./lus2lic {-ec -o lustre_test1_ok.ec lustre_test1_ok.lus} PASS: ./myec2c {-o lustre_test1_ok.c lustre_test1_ok.ec} @@ -1223,7 +1230,7 @@ PASS: ./myec2c {-o multipar.c multipar.ec} PASS: /home/jahier/lus2lic/test/../utils/test_lus2lic_no_node multipar.lus {} ==> lus2lic4.sum <== -Test Run By jahier on Thu Oct 9 09:38:11 +Test Run By jahier on Thu Oct 9 10:16:59 Native configuration is x86_64-unknown-linux-gnu === lus2lic4 tests === @@ -1708,8 +1715,8 @@ PASS: /home/jahier/lus2lic/test/../utils/test_lus2lic_no_node zzz2.lus {} === lus2lic3 Summary === -# of expected passes 464 -# of unexpected failures 20 +# of expected passes 485 +# of unexpected failures 6 ==> lus2lic4.sum <== @@ -1718,15 +1725,15 @@ PASS: /home/jahier/lus2lic/test/../utils/test_lus2lic_no_node zzz2.lus {} # of expected passes 447 # of unexpected failures 3 =============================== -# Total number of failures: 28 +# Total number of failures: 14 lus2lic0.log:testcase ./lus2lic.tests/test0.exp completed in 0 seconds -lus2lic1.log:testcase ./lus2lic.tests/test1.exp completed in 23 seconds -lus2lic2.log:testcase ./lus2lic.tests/test2.exp completed in 63 seconds -lus2lic3.log:testcase ./lus2lic.tests/test3.exp completed in 18 seconds -lus2lic4.log:testcase ./lus2lic.tests/test4.exp completed in 67 seconds +lus2lic1.log:testcase ./lus2lic.tests/test1.exp completed in 27 seconds +lus2lic2.log:testcase ./lus2lic.tests/test2.exp completed in 68 seconds +lus2lic3.log:testcase ./lus2lic.tests/test3.exp completed in 21 seconds +lus2lic4.log:testcase ./lus2lic.tests/test4.exp completed in 68 seconds * Ref time: -0.06user 0.07system 2:45.60elapsed 0%CPU (0avgtext+0avgdata 3000maxresident)k +0.04user 0.09system 3:31.78elapsed 0%CPU (0avgtext+0avgdata 3004maxresident)k 120inputs+0outputs (0major+14863minor)pagefaults 0swaps * Quick time (-j 4): -0.04user 0.09system 1:15.78elapsed 0%CPU (0avgtext+0avgdata 3008maxresident)k -120inputs+0outputs (0major+14883minor)pagefaults 0swaps +0.06user 0.08system 1:14.05elapsed 0%CPU (0avgtext+0avgdata 3004maxresident)k +120inputs+0outputs (0major+14862minor)pagefaults 0swaps diff --git a/test/lus2lic.time b/test/lus2lic.time index abf43558..363a6028 100644 --- a/test/lus2lic.time +++ b/test/lus2lic.time @@ -1,11 +1,11 @@ lus2lic0.log:testcase ./lus2lic.tests/test0.exp completed in 0 seconds -lus2lic1.log:testcase ./lus2lic.tests/test1.exp completed in 23 seconds -lus2lic2.log:testcase ./lus2lic.tests/test2.exp completed in 63 seconds -lus2lic3.log:testcase ./lus2lic.tests/test3.exp completed in 18 seconds -lus2lic4.log:testcase ./lus2lic.tests/test4.exp completed in 67 seconds +lus2lic1.log:testcase ./lus2lic.tests/test1.exp completed in 27 seconds +lus2lic2.log:testcase ./lus2lic.tests/test2.exp completed in 68 seconds +lus2lic3.log:testcase ./lus2lic.tests/test3.exp completed in 21 seconds +lus2lic4.log:testcase ./lus2lic.tests/test4.exp completed in 68 seconds * Ref time: -0.06user 0.07system 2:45.60elapsed 0%CPU (0avgtext+0avgdata 3000maxresident)k +0.04user 0.09system 3:31.78elapsed 0%CPU (0avgtext+0avgdata 3004maxresident)k 120inputs+0outputs (0major+14863minor)pagefaults 0swaps * Quick time (-j 4): -0.04user 0.09system 1:15.78elapsed 0%CPU (0avgtext+0avgdata 3008maxresident)k -120inputs+0outputs (0major+14883minor)pagefaults 0swaps +0.06user 0.08system 1:14.05elapsed 0%CPU (0avgtext+0avgdata 3004maxresident)k +120inputs+0outputs (0major+14862minor)pagefaults 0swaps -- GitLab