Skip to content
Snippets Groups Projects
Commit 038257f6 authored by Erwan Jahier's avatar Erwan Jahier
Browse files

Soc2c: raises assert false when slices are encountered

nb:  unexpected failures  115->120
parent 617653ae
No related branches found
No related tags found
No related merge requests found
(* Time-stamp: <modified the 24/06/2014 (at 17:14) by Erwan Jahier> *)
(* Time-stamp: <modified the 24/06/2014 (at 17:49) by Erwan Jahier> *)
(* let put (os: out_channel) (fmt:('a, unit, string, unit) format4) : 'a = *)
......@@ -106,9 +106,12 @@ let (is_memory_less : Soc.t -> bool) = SocUtils.is_memory_less
let string_of_var_expr = Soc2cUtil.string_of_var_expr
open Soc
let var_expr_is_not_a_slice = function Slice _ -> false | _ -> true
let (gao2c : Soc.tbl -> 'a soc_pp -> Soc.gao -> unit) =
fun stbl sp gao ->
let string_of_var_expr_list vel =
List.iter (fun ve -> assert(var_expr_is_not_a_slice ve)) vel;
let vel = List.map (string_of_var_expr sp.soc) vel in
String.concat "," vel
in
......@@ -135,9 +138,13 @@ let (gao2c : Soc.tbl -> 'a soc_pp -> Soc.gao -> unit) =
)
| Call(vel_out, Assign, vel_in) -> (
let gen_assign2 vi vo =
Soc2cUtil.gen_assign (Soc.data_type_of_var_expr vi)
(string_of_var_expr sp.soc vi) (string_of_var_expr sp.soc vo)
(Printf.sprintf "sizeof(%s)" (string_of_var_expr sp.soc vo))
match vi,vo with
| Slice _, _ -> assert false
| _, Slice _ -> assert false
| _,_ ->
Soc2cUtil.gen_assign (Soc.data_type_of_var_expr vi)
(string_of_var_expr sp.soc vi) (string_of_var_expr sp.soc vo)
(Printf.sprintf "sizeof(%s)" (string_of_var_expr sp.soc vo))
in
let l = List.map2 gen_assign2 vel_out vel_in in
String.concat "" l
......@@ -145,6 +152,8 @@ let (gao2c : Soc.tbl -> 'a soc_pp -> Soc.gao -> unit) =
| Call(vel_out, Method((inst_name,sk),sname), vel_in) -> (
let called_soc = Soc.SocMap.find sk stbl in
let ctx = Printf.sprintf "ctx->%s" (id2s inst_name) in
List.iter (fun ve -> assert(var_expr_is_not_a_slice ve)) vel_in;
List.iter (fun ve -> assert(var_expr_is_not_a_slice ve)) vel_out;
let vel_in = List.map (string_of_var_expr sp.soc) vel_in in
let vel_out = List.map (string_of_var_expr sp.soc) vel_out in
Soc2cUtil.gen_step_call sp.soc called_soc vel_out vel_in ctx sname
......@@ -153,6 +162,8 @@ let (gao2c : Soc.tbl -> 'a soc_pp -> Soc.gao -> unit) =
| Call(vel_out, Procedure sk, vel_in) -> (
let called_soc = Soc.SocMap.find sk stbl in
let ctx = get_ctx_name called_soc.key in
List.iter (fun ve -> assert(var_expr_is_not_a_slice ve)) vel_in;
List.iter (fun ve -> assert(var_expr_is_not_a_slice ve)) vel_out;
let vel_in = List.map (string_of_var_expr sp.soc) vel_in in
let vel_out = List.map (string_of_var_expr sp.soc) vel_out in
Soc2cUtil.gen_step_call sp.soc called_soc vel_out vel_in ctx "step" ""
......@@ -223,7 +234,9 @@ let (soc2c: int -> out_channel -> out_channel -> Soc.tbl -> Soc.t -> unit) =
List.iter (gen_instance_init_call sp) soc.instances;
(match soc.key with
(* set the parameter fields that have a default value (arrow,fby) *)
| (_,_,MemInit (ve)) -> cfmt "\n ctx->_memory = %s;" (string_of_var_expr soc ve)
| (_,_,MemInit (ve)) ->
assert(var_expr_is_not_a_slice ve);
cfmt "\n ctx->_memory = %s;" (string_of_var_expr soc ve)
| _ -> ()
);
cfmt "
......
(* Time-stamp: <modified the 24/06/2014 (at 17:14) by Erwan Jahier> *)
(* Time-stamp: <modified the 24/06/2014 (at 17:40) by Erwan Jahier> *)
(* exported *)
......@@ -91,5 +91,4 @@ let rec (string_of_var_expr: Soc.t -> Soc.var_expr -> string) =
Printf.sprintf "ctx->%s" (id2s id)
| Field(f, id,_) -> Printf.sprintf "%s.%s" (string_of_var_expr soc f) (id2s id)
| Index(f, index,_) -> Printf.sprintf "%s[%i]" (string_of_var_expr soc f) index
| Slice(f,fi,la,st,wi,vt) -> Printf.sprintf "%s[%i..%i step %i]; // XXX fixme!\n"
(string_of_var_expr soc f) fi la st
| Slice(f,fi,la,st,wi,vt) -> assert false (* should not occur *)
Test Run By jahier on Tue Jun 24 17:20:32 2014
Test Run By jahier on Tue Jun 24 18:01:59 2014
Native configuration is i686-pc-linux-gnu
=== lus2lic tests ===
......@@ -431,7 +431,7 @@ PASS: ./lus2lic {-o /tmp/morel3.lic should_work/morel3.lus}
PASS: ./lus2lic {-ec -o /tmp/morel3.ec should_work/morel3.lus}
PASS: ./myec2c {-o /tmp/morel3.c /tmp/morel3.ec}
PASS: ../utils/test_lus2lic_no_node should_work/morel3.lus
PASS: ./lus2lic {-2c should_work/morel3.lus -n morel3}
FAIL: Generate c code : ./lus2lic {-2c should_work/morel3.lus -n morel3}
FAIL: Check that the generated C code compiles : gcc morel3_morel3.c morel3_morel3_loop.c
PASS: ./lus2lic {-o /tmp/fresh_name.lic should_work/fresh_name.lus}
PASS: ./lus2lic {-ec -o /tmp/fresh_name.ec should_work/fresh_name.lus}
......@@ -563,7 +563,7 @@ PASS: ./lus2lic {-o /tmp/morel4.lic should_work/morel4.lus}
PASS: ./lus2lic {-ec -o /tmp/morel4.ec should_work/morel4.lus}
PASS: ./myec2c {-o /tmp/morel4.c /tmp/morel4.ec}
PASS: ../utils/test_lus2lic_no_node should_work/morel4.lus
PASS: ./lus2lic {-2c should_work/morel4.lus -n morel4}
FAIL: Generate c code : ./lus2lic {-2c should_work/morel4.lus -n morel4}
FAIL: Check that the generated C code compiles : gcc morel4_morel4.c morel4_morel4_loop.c
PASS: ./lus2lic {-o /tmp/trivial_array.lic should_work/trivial_array.lus}
FAIL: Generate ec code : ./lus2lic {-ec -o /tmp/trivial_array.ec should_work/trivial_array.lus}
......@@ -782,7 +782,7 @@ PASS: ./lus2lic {-o /tmp/left.lic should_work/left.lus}
PASS: ./lus2lic {-ec -o /tmp/left.ec should_work/left.lus}
PASS: ./myec2c {-o /tmp/left.c /tmp/left.ec}
PASS: ../utils/test_lus2lic_no_node should_work/left.lus
PASS: ./lus2lic {-2c should_work/left.lus -n left}
FAIL: Generate c code : ./lus2lic {-2c should_work/left.lus -n left}
FAIL: Check that the generated C code compiles : gcc left_left.c left_left_loop.c
PASS: ./lus2lic {-o /tmp/ts04.lic should_work/ts04.lus}
PASS: ./lus2lic {-ec -o /tmp/ts04.ec should_work/ts04.lus}
......@@ -808,7 +808,7 @@ PASS: ./lus2lic {-o /tmp/morel.lic should_work/morel.lus}
PASS: ./lus2lic {-ec -o /tmp/morel.ec should_work/morel.lus}
PASS: ./myec2c {-o /tmp/morel.c /tmp/morel.ec}
PASS: ../utils/test_lus2lic_no_node should_work/morel.lus
PASS: ./lus2lic {-2c should_work/morel.lus -n morel}
FAIL: Generate c code : ./lus2lic {-2c should_work/morel.lus -n morel}
FAIL: Check that the generated C code compiles : gcc morel_morel.c morel_morel_loop.c
PASS: ./lus2lic {-o /tmp/SOURIS.lic should_work/SOURIS.lus}
PASS: ./lus2lic {-ec -o /tmp/SOURIS.ec should_work/SOURIS.lus}
......@@ -949,7 +949,7 @@ PASS: ./lus2lic {-o /tmp/morel2.lic should_work/morel2.lus}
PASS: ./lus2lic {-ec -o /tmp/morel2.ec should_work/morel2.lus}
PASS: ./myec2c {-o /tmp/morel2.c /tmp/morel2.ec}
PASS: ../utils/test_lus2lic_no_node should_work/morel2.lus
PASS: ./lus2lic {-2c should_work/morel2.lus -n morel2}
FAIL: Generate c code : ./lus2lic {-2c should_work/morel2.lus -n morel2}
FAIL: Check that the generated C code compiles : gcc morel2_morel2.c morel2_morel2_loop.c
PASS: ./lus2lic {-o /tmp/minmax1.lic should_work/minmax1.lus}
PASS: ./lus2lic {-ec -o /tmp/minmax1.ec should_work/minmax1.lus}
......@@ -1482,11 +1482,9 @@ XPASS: Test bad programs (semantics): lus2lic {-o /tmp/bug.lic should_fail/seman
=== lus2lic Summary ===
# of expected passes 1297
# of unexpected failures 115
# of expected passes 1292
# of unexpected failures 120
# of unexpected successes 21
# of expected failures 37
testcase ./lus2lic.tests/non-reg.exp completed in 136 seconds
testcase ./lus2lic.tests/progression.exp completed in 0 seconds
testcase ./lus2lic.tests/non-reg.exp completed in 136 seconds
testcase ./lus2lic.tests/non-reg.exp completed in 132 seconds
testcase ./lus2lic.tests/progression.exp completed in 0 seconds
testcase ./lus2lic.tests/non-reg.exp completed in 136 seconds
testcase ./lus2lic.tests/non-reg.exp completed in 132 seconds
testcase ./lus2lic.tests/progression.exp completed in 0 seconds
......@@ -60,8 +60,6 @@ http://www.di.ens.fr/~pouzet/bib/lctes12.pdf
6. file:test/should_work/morel3.lus lus2lic -2c should_work/morel3.lus -n morel3
7. file:test/should_work/ply03.lus lus2lic -2c should_work/ply03.lus -n ply03
8. file:test/should_work/xx.lus lus2lic -2c should_work/xx.lus -n xx
9. file:test/should_work/test.lus lus2lic -2c should_work/test.lus -n test
10. file:test/should_work/morel4.lus lus2lic -2c should_work/morel4.lus -n morel4
11. file:test/should_work/bad.lus lus2lic -2c should_work/bad.lus -n bad
12. file:test/should_work/mapinf.lus lus2lic -2c should_work/mapinf.lus -n mapinf
13. file:test/should_work/over2.lus lus2lic -2c should_work/over2.lus -n over2
......@@ -82,7 +80,8 @@ http://www.di.ens.fr/~pouzet/bib/lctes12.pdf
28. file:test/should_work/overload.lus lus2lic -2c should_work/overload.lus -n overload
29. file:test/should_work/simple.lus lus2lic -2c should_work/simple.lus -n simple
type externe
10. file:test/should_work/morel4.lus lus2lic -2c should_work/morel4.lus -n morel4
slice en partie gauche
* Packages, modeles, etc.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment