Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Spot
divine-ltsmin-deb
Commits
853761a4
Commit
853761a4
authored
Mar 09, 2020
by
Etienne Renault
Browse files
Check out-of-bound during the computation
of successors * tools/dvecompile.cpp, tools/dvecompile.h: here.
parent
9d1698f0
Changes
2
Hide whitespace changes
Inline
Side-by-side
tools/dvecompile.cpp
View file @
853761a4
...
...
@@ -982,6 +982,7 @@ void dve_compiler::transition_effect( ext_transition_t *et, std::string in, std:
}
}
//first transition effect
assign
(
process_state
(
et
->
first
->
get_process_gid
(),
out
),
fmt
(
et
->
first
->
get_state2_lid
()
)
);
...
...
tools/dvecompile.h
View file @
853761a4
...
...
@@ -161,7 +161,7 @@ struct dve_compiler: public dve_explicit_system_t
}
void
assign
(
std
::
string
left
,
std
::
string
right
)
{
line
(
left
+
" = "
+
right
+
";"
);
line
(
left
+
" = "
+
right
+
";"
);
}
std
::
string
relate
(
std
::
string
left
,
std
::
string
op
,
std
::
string
right
)
{
...
...
@@ -201,9 +201,55 @@ struct dve_compiler: public dve_explicit_system_t
std
::
string
cmaybe
(
dve_expression_t
&
expr
,
std
::
string
state
);
std
::
string
cexpr
(
dve_expression_t
&
expr
,
std
::
string
state
,
bool
wrap
);
void
print_cexpr
(
dve_expression_t
&
expr
,
std
::
string
state
)
{
line
(
cexpr
(
expr
,
state
,
false
)
+
";"
);
template
<
typename
T
>
string
to_string
(
T
val
)
{
stringstream
stream
;
stream
<<
val
;
return
stream
.
str
();
}
void
print_check_bounds
(
dve_expression_t
&
expr
,
std
::
string
state
)
{
assert
(
expr
.
get_operator
()
==
T_SQUARE_BRACKETS
);
if
(
!
expr
.
arity
())
return
;
dve_symbol_table_t
*
parent_table
=
expr
.
get_symbol_table
();
line
(
"// Here check out-of-bounds"
);
line
(
"if ("
+
to_string
(
parent_table
->
get_variable
(
expr
.
get_ident_gid
())
->
get_vector_size
())
+
"<="
+
to_string
(
cexpr
(
*
expr
.
subexpr
(
0
),
state
,
false
))
+
")"
);
line
(
"{ /* fprintf( stderr,
\"
Out-of-bound! see line:
\"
);*/ return -1; }"
);
}
void
print_cexpr
(
dve_expression_t
&
expr
,
std
::
string
state
)
{
if
(
expr
.
get_operator
()
==
T_SQUARE_BRACKETS
)
{
print_check_bounds
(
expr
,
state
);
}
// Case where we perform exp_1 = expr_2
else
if
(
expr
.
get_operator
()
==
T_ASSIGNMENT
)
{
dve_symbol_table_t
*
parent_table
=
expr
.
get_symbol_table
();
if
(
expr
.
left
()
->
get_operator
()
==
T_SQUARE_BRACKETS
&&
parent_table
->
get_variable
(
expr
.
left
()
->
get_ident_gid
())
->
is_vector
())
{
print_check_bounds
(
*
expr
.
left
(),
state
);
}
if
(
expr
.
right
()
->
get_operator
()
==
T_SQUARE_BRACKETS
&&
parent_table
->
get_variable
(
expr
.
right
()
->
get_ident_gid
())
->
is_vector
())
{
print_check_bounds
(
*
expr
.
right
(),
state
);
}
}
line
(
cexpr
(
expr
,
state
,
false
)
+
";"
);
}
void
new_label
()
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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