Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
verimag
synchrone
lustre-v6
Commits
051d1a17
Commit
051d1a17
authored
Mar 15, 2021
by
erwan
Browse files
Fix: lv6 -exec was raising a spurious runtime error
parent
fe2e657b
Changes
3
Hide whitespace changes
Inline
Side-by-side
bin/main.ml
View file @
051d1a17
(* Time-stamp: <modified the 1
2
/03/202
0
(at 1
1:45
) by Erwan Jahier> *)
(* Time-stamp: <modified the 1
5
/03/202
1
(at 1
2:28
) by Erwan Jahier> *)
open
AstV6
open
Lxm
...
...
@@ -324,12 +324,12 @@ could try one the options: -2c, -2c-exec, -exec, -ec, -lic, or -h for more optio
|
Parse_error
->
print_compile_error
(
Lxm
.
last_made
()
)
"Syntax error"
;
my_exit
opt
1
|
Unknown_var
(
lxm
,
id
)
->
print_
compil
e_error
lxm
(
"unknown variable ("
^
(
Lv6Id
.
to_string
id
)
^
")"
);
print_
runtim
e_error
lxm
(
"unknown variable ("
^
(
Lv6Id
.
to_string
id
)
^
")"
);
my_exit
opt
1
|
Unknown_constant
(
lxm
,
str
)
->
print_
compil
e_error
lxm
(
"unknown constant ("
^
str
^
")"
);
print_
runtim
e_error
lxm
(
"unknown constant ("
^
str
^
")"
);
my_exit
opt
1
|
Compile_error
(
lxm
,
msg
)
->
print_
compil
e_error
lxm
msg
;
my_exit
opt
1
|
Compile_error
(
lxm
,
msg
)
->
print_
runtim
e_error
lxm
msg
;
my_exit
opt
1
|
L2lCheckLoops
.
Error
(
lxm
,
msg
,
lic_prg
)
->
(* Sometime it helps to see the current state of the faulty program *)
LicPrg
.
to_file
opt
lic_prg
main_node
;
...
...
@@ -337,7 +337,10 @@ could try one the options: -2c, -2c-exec, -exec, -ec, -lic, or -h for more optio
print_compile_error
lxm
msg
;
my_exit
opt
1
|
SocExec
.
AssertViolation
lxm
->
print_compile_error
lxm
"An assertion is violated in the Lustre program"
;
print_runtime_error
lxm
"An assertion is violated in the Lustre program"
;
my_exit
opt
1
|
Failure
msg
->
Printf
.
eprintf
"
\n
Runtime Error: %s
\n
"
msg
;
my_exit
opt
1
|
Assert_failure
(
file
,
line
,
col
)
->
prerr_string
(
...
...
lib/lv6errors.ml
View file @
051d1a17
(* Time-stamp: <modified the
29
/0
8
/201
9
(at 1
4:17
) by Erwan Jahier> *)
(* Time-stamp: <modified the
15
/0
3
/20
2
1 (at 1
2:22
) by Erwan Jahier> *)
(** *)
...
...
@@ -105,6 +105,9 @@ Formatage standard des erreurs de compil
let
compile_error_string
lxm
msg
=
(
Printf
.
sprintf
"
\n
Error: %s:
\n
Error: %s
\n
"
(
Lxm
.
details
lxm
)
msg
)
let
runtime_error_string
lxm
msg
=
(
Printf
.
sprintf
"
\n
Runtime Error: %s:
\n
Error: %s
\n
"
(
Lxm
.
details
lxm
)
msg
)
(** ---------------------------------------------------------------------
Message d'erreur (associé à un lexeme) sur stderr
...
...
@@ -114,6 +117,11 @@ let print_compile_error lxm msg = (
flush
stderr
)
let
print_runtime_error
lxm
msg
=
(
Printf
.
eprintf
"%s
\n
"
(
compile_error_string
lxm
msg
);
flush
stderr
)
(** ---------------------------------------------------------------------
Warning (associé à un lexeme) sur stderr
----------------------------------------------------------------------*)
...
...
lib/socExecValue.ml
View file @
051d1a17
(* Time-stamp: <modified the
06
/03/202
0
(at 1
3:30
) by Erwan Jahier> *)
(* Time-stamp: <modified the
15
/03/202
1
(at 1
5:44
) by Erwan Jahier> *)
let
dbg
=
(
Lv6Verbose
.
get_flag
"exec"
)
...
...
@@ -285,11 +285,17 @@ let rec (get_value : ctx -> var_expr -> Data.v) =
|
Field
(
ve
,
fn
,_
t
)
->
let
s
=
get_value
ctx
ve
in
(
match
s
with
|
S
fl
->
(
try
List
.
assoc
fn
fl
with
Not_found
->
assert
false
(* should not occur *)
|
U
->
U
|
S
fl
->
(
try
List
.
assoc
fn
fl
with
Not_found
->
assert
false
(* should not occur *)
)
|
_
->
assert
false
(* should not occur *)
|
_
->
let
msg
=
Printf
.
sprintf
"'%s' is not a struct
\n
"
(
SocUtils
.
string_of_filter
ve
)
in
failwith
msg
(* assert false (* should not occur *) *)
)
|
Index
(
ve
,
i
,_
vt
)
->
(
let
a
=
get_value
ctx
ve
in
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment