Skip to content
Snippets Groups Projects
Commit a0197e0c authored by erwan's avatar erwan
Browse files

soc2c: fix change acc2dbb3 that used memcmp to perform array comparisons

Indeed,
   x=y iff memcmp(x,y) == 0
not
   x=y iff memcmp(x,y) != 0
!
parent ff567b8a
No related branches found
No related tags found
No related merge requests found
OASISFormat: 0.4 OASISFormat: 0.4
Name: lustre-v6 Name: lustre-v6
Version: 1.705 Version: 1.706
Synopsis: The Lustre V6 Verimag compiler Synopsis: The Lustre V6 Verimag compiler
Description: This package contains: Description: This package contains:
(1) lus2lic: the (current) name of the compiler (and interpreter via -exec). (1) lus2lic: the (current) name of the compiler (and interpreter via -exec).
......
(** Automatically generated from Makefile *) (** Automatically generated from Makefile *)
let tool = "lus2lic" let tool = "lus2lic"
let branch = "master" let branch = "master"
let commit = "705" let commit = "706"
let sha_1 = "f59c754fabfc6dbb08bc8d74c6d53bbbe0f86f70" let sha_1 = "ff567b8a3b0197116b5582764af9bba04cf70391"
let str = (branch ^ "." ^ commit ^ " (" ^ sha_1 ^ ")") let str = (branch ^ "." ^ commit ^ " (" ^ sha_1 ^ ")")
let maintainer = "jahier@imag.fr" let maintainer = "jahier@imag.fr"
(* Time-stamp: <modified the 10/07/2017 (at 11:04) by Erwan Jahier> *) (* Time-stamp: <modified the 10/07/2017 (at 13:12) by Erwan Jahier> *)
(* let put (os: out_channel) (fmt:('a, unit, string, unit) format4) : 'a = *) (* let put (os: out_channel) (fmt:('a, unit, string, unit) format4) : 'a = *)
...@@ -119,19 +119,19 @@ let (step2c : Soc.tbl -> 'a soc_pp -> Soc.step_method -> unit) = ...@@ -119,19 +119,19 @@ let (step2c : Soc.tbl -> 'a soc_pp -> Soc.step_method -> unit) =
(match sp.soc.key with (match sp.soc.key with
| ("Lustre::eq",(Array _)::_,_) -> | ("Lustre::eq",(Array _)::_,_) ->
let str = Printf.sprintf let str = Printf.sprintf
" *out = memcmp((const void *) i1, (const void *) i2, %s)!=0;\n" ctype in " *out = memcmp((const void *) i1, (const void *) i2, %s)==0;\n" ctype in
sp.cput str sp.cput str
| ("Lustre::eq",(Struct _)::_,_) -> | ("Lustre::eq",(Struct _)::_,_) ->
let str = Printf.sprintf let str = Printf.sprintf
" *out = memcmp((const void *) &i1, (const void *) &i2, %s)!=0;\n" ctype in " *out = memcmp((const void *) &i1, (const void *) &i2, %s)==0;\n" ctype in
sp.cput str sp.cput str
| ("Lustre::neq",(Array _)::_,_) -> | ("Lustre::neq",(Array _)::_,_) ->
let str = Printf.sprintf let str = Printf.sprintf
" *out = !memcmp((const void *) i1, (const void *) i2, %s)!=0;\n" ctype in " *out = !memcmp((const void *) i1, (const void *) i2, %s)==0;\n" ctype in
sp.cput str sp.cput str
| ("Lustre::neq",(Struct _)::_,_) -> | ("Lustre::neq",(Struct _)::_,_) ->
let str = Printf.sprintf let str = Printf.sprintf
" *out = !memcmp((const void *) &i1, (const void *) &i2, %s)!=0;\n" ctype in " *out = !memcmp((const void *) &i1, (const void *) &i2, %s)==0;\n" ctype in
sp.cput str sp.cput str
| n -> sp.cput (Soc2cDep.get_predef_op n) | n -> sp.cput (Soc2cDep.get_predef_op n)
) )
......
(* Time-stamp: <modified the 10/07/2017 (at 10:48) by Erwan Jahier> *) (* Time-stamp: <modified the 10/07/2017 (at 13:12) by Erwan Jahier> *)
(* A local exception used to check if a predef is supported. (* A local exception used to check if a predef is supported.
The idea is that when gen_call_do is called with empty lists, The idea is that when gen_call_do is called with empty lists,
...@@ -25,7 +25,7 @@ let stdbin_eq_array is_eq (op,tl,_) ll rl = ...@@ -25,7 +25,7 @@ let stdbin_eq_array is_eq (op,tl,_) ll rl =
let not_opt = if is_eq then "" else "!" in let not_opt = if is_eq then "" else "!" in
match (ll,rl) with match (ll,rl) with
| ([l], [r1;r2]) -> | ([l], [r1;r2]) ->
Printf.sprintf " %s = %smemcmp(%s %s, %s %s, %s)!=0;\n" Printf.sprintf " %s = %smemcmp(%s %s, %s %s, %s)==0;\n"
l not_opt cast r1 cast r2 ctype l not_opt cast r1 cast r2 ctype
| ([],[]) -> raise Is_supported | ([],[]) -> raise Is_supported
| _ -> assert false | _ -> assert false
...@@ -40,7 +40,7 @@ let stdbin_eq_struct is_eq (op,tl,_) ll rl = ...@@ -40,7 +40,7 @@ let stdbin_eq_struct is_eq (op,tl,_) ll rl =
let not_opt = if is_eq then "" else "!" in let not_opt = if is_eq then "" else "!" in
match (ll,rl) with match (ll,rl) with
| ([l], [r1;r2]) -> | ([l], [r1;r2]) ->
Printf.sprintf " %s = %smemcmp(%s &%s, %s &%s, %s)!=0;\n" Printf.sprintf " %s = %smemcmp(%s &%s, %s &%s, %s)==0;\n"
l not_opt cast r1 cast r2 ctype l not_opt cast r1 cast r2 ctype
| ([],[]) -> raise Is_supported | ([],[]) -> raise Is_supported
| _ -> assert false | _ -> assert false
......
(* Time-stamp: <modified the 27/06/2017 (at 11:38) by Erwan Jahier> *) (* Time-stamp: <modified the 10/07/2017 (at 13:12) by Erwan Jahier> *)
open Data open Data
open Soc open Soc
...@@ -16,16 +16,16 @@ let (lustre_binop : Soc.key -> string -> string) = ...@@ -16,16 +16,16 @@ let (lustre_binop : Soc.key -> string -> string) =
in in
(match sk with (match sk with
| (("Lustre::eq"|"Lustre::equal"),(Array _)::_,_) -> | (("Lustre::eq"|"Lustre::equal"),(Array _)::_,_) ->
Printf.sprintf " %s.out = memcmp(%s %s.i1, %s %s.i2, %s)!=0;\n" Printf.sprintf " %s.out = memcmp(%s %s.i1, %s %s.i2, %s)==0;\n"
ctx ctx cast ctx cast ctype ctx ctx cast ctx cast ctype
| (("Lustre::eq"|"Lustre::equal"),(Struct _)::_,_) -> | (("Lustre::eq"|"Lustre::equal"),(Struct _)::_,_) ->
Printf.sprintf " %s.out = memcmp(%s &%s.i1, %s &%s.i2, %s)!=0;\n" Printf.sprintf " %s.out = memcmp(%s &%s.i1, %s &%s.i2, %s)==0;\n"
ctx ctx cast ctx cast ctype ctx ctx cast ctx cast ctype
| (("Lustre::neq"|"Lustre::diff"),(Array _)::_,_) -> | (("Lustre::neq"|"Lustre::diff"),(Array _)::_,_) ->
Printf.sprintf " %s.out = !memcmp(%s %s.i1, %s %s.i2, %s)!=0;\n" Printf.sprintf " %s.out = !memcmp(%s %s.i1, %s %s.i2, %s)==0;\n"
ctx ctx cast ctx cast ctype ctx ctx cast ctx cast ctype
| (("Lustre::neq"|"Lustre::diff"),(Struct _)::_,_) -> | (("Lustre::neq"|"Lustre::diff"),(Struct _)::_,_) ->
Printf.sprintf " %s.out = !memcmp(%s &%s.i1, %s &%s.i2, %s)!=0;\n" Printf.sprintf " %s.out = !memcmp(%s &%s.i1, %s &%s.i2, %s)==0;\n"
ctx ctx cast ctx cast ctype ctx ctx cast ctx cast ctype
| _ -> | _ ->
Printf.sprintf " %s.out = (%s.i1 %s %s.i2);\n" ctx ctx op ctx Printf.sprintf " %s.out = (%s.i1 %s %s.i2);\n" ctx ctx op ctx
......
(* Time-stamp: <modified the 10/07/2017 (at 10:51) by Erwan Jahier> *) (* Time-stamp: <modified the 10/07/2017 (at 13:12) by Erwan Jahier> *)
open Data open Data
open Soc open Soc
...@@ -15,13 +15,13 @@ let (lustre_binop : Soc.key -> string -> string) = ...@@ -15,13 +15,13 @@ let (lustre_binop : Soc.key -> string -> string) =
in in
(match sk with (match sk with
| (("Lustre::eq"|"Lustre::equal"),(Array _)::_,_) -> | (("Lustre::eq"|"Lustre::equal"),(Array _)::_,_) ->
Printf.sprintf " *out = memcmp(%s i1, %s i2, %s)!=0;\n" cast cast ctype Printf.sprintf " *out = memcmp(%s i1, %s i2, %s)==0;\n" cast cast ctype
| (("Lustre::eq"|"Lustre::equal"),(Struct _)::_,_) -> | (("Lustre::eq"|"Lustre::equal"),(Struct _)::_,_) ->
Printf.sprintf " *out = memcmp(%s &i1, %s &i2, %s)!=0;\n" cast cast ctype Printf.sprintf " *out = memcmp(%s &i1, %s &i2, %s)==0;\n" cast cast ctype
| (("Lustre::neq"|"Lustre::diff"),(Array _)::_,_) -> | (("Lustre::neq"|"Lustre::diff"),(Array _)::_,_) ->
Printf.sprintf " *out = !memcmp(%s i1, %s i2, %s)!=0;\n" cast cast ctype Printf.sprintf " *out = !memcmp(%s i1, %s i2, %s)==0;\n" cast cast ctype
| (("Lustre::neq"|"Lustre::diff"),(Struct _)::_,_) -> | (("Lustre::neq"|"Lustre::diff"),(Struct _)::_,_) ->
Printf.sprintf " *out = !memcmp(%s &i1, %s &i2, %s)!=0;\n" cast cast ctype Printf.sprintf " *out = !memcmp(%s &i1, %s &i2, %s)==0;\n" cast cast ctype
| _ -> | _ ->
Printf.sprintf " *out = (i1 %s i2);\n" op Printf.sprintf " *out = (i1 %s i2);\n" op
......
==> lus2lic0.sum <== ==> lus2lic0.sum <==
Test Run By jahier on Mon Jul 10 11:09:50 Test Run By jahier on Mon Jul 10 13:16:38
Native configuration is x86_64-unknown-linux-gnu Native configuration is x86_64-unknown-linux-gnu
=== lus2lic0 tests === === lus2lic0 tests ===
...@@ -64,7 +64,7 @@ XFAIL: Test bad programs (assert): test_lus2lic_no_node should_fail/assert/lecte ...@@ -64,7 +64,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 XFAIL: Test bad programs (assert): test_lus2lic_no_node should_fail/assert/s.lus
==> lus2lic1.sum <== ==> lus2lic1.sum <==
Test Run By jahier on Mon Jul 10 11:09:51 Test Run By jahier on Mon Jul 10 13:16:39
Native configuration is x86_64-unknown-linux-gnu Native configuration is x86_64-unknown-linux-gnu
=== lus2lic1 tests === === lus2lic1 tests ===
...@@ -135,7 +135,7 @@ PASS: sh array_concat2.sh ...@@ -135,7 +135,7 @@ PASS: sh array_concat2.sh
PASS: /home/jahier/lus2lic/test/../utils/compare_exec_and_2c array_concat2.lus {} PASS: /home/jahier/lus2lic/test/../utils/compare_exec_and_2c array_concat2.lus {}
PASS: ./lus2lic {-2c array_equals.lus -n array_equals} PASS: ./lus2lic {-2c array_equals.lus -n array_equals}
PASS: sh array_equals.sh PASS: sh array_equals.sh
FAIL: Try to compare lus2lic -exec and -2c: /home/jahier/lus2lic/test/../utils/compare_exec_and_2c array_equals.lus {} PASS: /home/jahier/lus2lic/test/../utils/compare_exec_and_2c array_equals.lus {}
PASS: ./lus2lic {-2c arrays.lus -n arrays} PASS: ./lus2lic {-2c arrays.lus -n arrays}
PASS: sh arrays.sh PASS: sh arrays.sh
PASS: /home/jahier/lus2lic/test/../utils/compare_exec_and_2c arrays.lus {} PASS: /home/jahier/lus2lic/test/../utils/compare_exec_and_2c arrays.lus {}
...@@ -258,7 +258,7 @@ PASS: sh enum0.sh ...@@ -258,7 +258,7 @@ PASS: sh enum0.sh
PASS: /home/jahier/lus2lic/test/../utils/compare_exec_and_2c enum0.lus {} PASS: /home/jahier/lus2lic/test/../utils/compare_exec_and_2c enum0.lus {}
PASS: ./lus2lic {-2c enum0_lv4.lus -n enum0_lv4} PASS: ./lus2lic {-2c enum0_lv4.lus -n enum0_lv4}
PASS: sh enum0_lv4.sh PASS: sh enum0_lv4.sh
FAIL: Try to compare lus2lic -exec and -2c: /home/jahier/lus2lic/test/../utils/compare_exec_and_2c enum0_lv4.lus {} PASS: /home/jahier/lus2lic/test/../utils/compare_exec_and_2c enum0_lv4.lus {}
PASS: ./lus2lic {-2c ex.lus -n ex} PASS: ./lus2lic {-2c ex.lus -n ex}
PASS: sh ex.sh PASS: sh ex.sh
PASS: /home/jahier/lus2lic/test/../utils/compare_exec_and_2c ex.lus {} PASS: /home/jahier/lus2lic/test/../utils/compare_exec_and_2c ex.lus {}
...@@ -403,7 +403,7 @@ PASS: sh multipar.sh ...@@ -403,7 +403,7 @@ PASS: sh multipar.sh
PASS: /home/jahier/lus2lic/test/../utils/compare_exec_and_2c multipar.lus {} PASS: /home/jahier/lus2lic/test/../utils/compare_exec_and_2c multipar.lus {}
==> lus2lic2.sum <== ==> lus2lic2.sum <==
Test Run By jahier on Mon Jul 10 11:10:52 Test Run By jahier on Mon Jul 10 13:17:34
Native configuration is x86_64-unknown-linux-gnu Native configuration is x86_64-unknown-linux-gnu
=== lus2lic2 tests === === lus2lic2 tests ===
...@@ -625,7 +625,7 @@ PASS: sh struct0.sh ...@@ -625,7 +625,7 @@ PASS: sh struct0.sh
PASS: /home/jahier/lus2lic/test/../utils/compare_exec_and_2c struct0.lus {} PASS: /home/jahier/lus2lic/test/../utils/compare_exec_and_2c struct0.lus {}
PASS: ./lus2lic {-2c struct_equality.lus -n struct_equality} PASS: ./lus2lic {-2c struct_equality.lus -n struct_equality}
PASS: sh struct_equality.sh PASS: sh struct_equality.sh
FAIL: Try to compare lus2lic -exec and -2c: /home/jahier/lus2lic/test/../utils/compare_exec_and_2c struct_equality.lus {} PASS: /home/jahier/lus2lic/test/../utils/compare_exec_and_2c struct_equality.lus {}
PASS: ./lus2lic {-2c struct_with.lus -n struct_with} PASS: ./lus2lic {-2c struct_with.lus -n struct_with}
PASS: sh struct_with.sh PASS: sh struct_with.sh
PASS: /home/jahier/lus2lic/test/../utils/compare_exec_and_2c struct_with.lus {} PASS: /home/jahier/lus2lic/test/../utils/compare_exec_and_2c struct_with.lus {}
...@@ -743,7 +743,7 @@ PASS: sh zzz2.sh ...@@ -743,7 +743,7 @@ PASS: sh zzz2.sh
PASS: /home/jahier/lus2lic/test/../utils/compare_exec_and_2c zzz2.lus {} PASS: /home/jahier/lus2lic/test/../utils/compare_exec_and_2c zzz2.lus {}
==> lus2lic3.sum <== ==> lus2lic3.sum <==
Test Run By jahier on Mon Jul 10 11:12:13 Test Run By jahier on Mon Jul 10 13:18:49
Native configuration is x86_64-unknown-linux-gnu Native configuration is x86_64-unknown-linux-gnu
=== lus2lic3 tests === === lus2lic3 tests ===
...@@ -1253,7 +1253,7 @@ PASS: /home/jahier/lus2lic/test/../utils/test_lus2lic_no_node multipar.lus {} ...@@ -1253,7 +1253,7 @@ PASS: /home/jahier/lus2lic/test/../utils/test_lus2lic_no_node multipar.lus {}
==> lus2lic4.sum <== ==> lus2lic4.sum <==
Test Run By jahier on Mon Jul 10 11:14:35 Test Run By jahier on Mon Jul 10 13:21:10
Native configuration is x86_64-unknown-linux-gnu Native configuration is x86_64-unknown-linux-gnu
=== lus2lic4 tests === === lus2lic4 tests ===
...@@ -1745,15 +1745,15 @@ PASS: /home/jahier/lus2lic/test/../utils/test_lus2lic_no_node zzz2.lus {} ...@@ -1745,15 +1745,15 @@ PASS: /home/jahier/lus2lic/test/../utils/test_lus2lic_no_node zzz2.lus {}
=== lus2lic1 Summary === === lus2lic1 Summary ===
# of expected passes 322 # of expected passes 324
# of unexpected failures 5 # of unexpected failures 3
==> lus2lic2.sum <== ==> lus2lic2.sum <==
=== lus2lic2 Summary === === lus2lic2 Summary ===
# of expected passes 326 # of expected passes 327
# of unexpected failures 2 # of unexpected failures 1
==> lus2lic3.sum <== ==> lus2lic3.sum <==
=== lus2lic3 Summary === === lus2lic3 Summary ===
...@@ -1769,15 +1769,15 @@ PASS: /home/jahier/lus2lic/test/../utils/test_lus2lic_no_node zzz2.lus {} ...@@ -1769,15 +1769,15 @@ PASS: /home/jahier/lus2lic/test/../utils/test_lus2lic_no_node zzz2.lus {}
# of expected passes 465 # of expected passes 465
# of unexpected failures 6 # of unexpected failures 6
=============================== ===============================
# Total number of failures: 22 # Total number of failures: 19
lus2lic0.log:testcase ./lus2lic.tests/test0.exp completed in 1 seconds lus2lic0.log:testcase ./lus2lic.tests/test0.exp completed in 1 seconds
lus2lic1.log:testcase ./lus2lic.tests/test1.exp completed in 61 seconds lus2lic1.log:testcase ./lus2lic.tests/test1.exp completed in 55 seconds
lus2lic2.log:testcase ./lus2lic.tests/test2.exp completed in 81 seconds lus2lic2.log:testcase ./lus2lic.tests/test2.exp completed in 75 seconds
lus2lic3.log:testcase ./lus2lic.tests/test3.exp completed in 142 seconds lus2lic3.log:testcase ./lus2lic.tests/test3.exp completed in 141 seconds
lus2lic4.log:testcase ./lus2lic.tests/test4.exp completed in 67 seconds lus2lic4.log:testcase ./lus2lic.tests/test4.exp completed in 68 seconds
* Ref time: * Ref time:
0.06user 0.01system 5:52.65elapsed 0%CPU (0avgtext+0avgdata 5592maxresident)k 0.05user 0.02system 5:40.63elapsed 0%CPU (0avgtext+0avgdata 5656maxresident)k
32inputs+0outputs (0major+6115minor)pagefaults 0swaps 64inputs+0outputs (0major+6170minor)pagefaults 0swaps
* Quick time (-j 4): * Quick time (-j 4):
0.06user 0.01system 2:42.20elapsed 0%CPU (0avgtext+0avgdata 5636maxresident)k 0.05user 0.02system 2:31.81elapsed 0%CPU (0avgtext+0avgdata 5664maxresident)k
64inputs+0outputs (0major+6138minor)pagefaults 0swaps 96inputs+0outputs (0major+6184minor)pagefaults 0swaps
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