Skip to content

Commit 78cabc8

Browse files
Petr BauchPetr Bauch
Petr Bauch
authored and
Petr Bauch
committed
Fix slicing by functions
1 parent 19f303a commit 78cabc8

File tree

3 files changed

+21
-9
lines changed

3 files changed

+21
-9
lines changed

regression/goto-instrument/fp-reachability-slice3/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
CORE
22
main.c
3-
--fp-reachability-slice c
3+
--fp-reachability-slice b:c
44
^EXIT=0$
55
^SIGNAL=0$
66
--

src/goto-instrument/reachability_slicer.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,12 @@ void reachability_slicert::fixedpoint_to_assertions(
8989
{
9090
// This is an end-of-function -> successor-of-callsite edge.
9191
// Queue both the caller and the end of the callee.
92-
INVARIANT(
93-
std::prev(node.PC)->is_function_call(),
94-
"all function return edges should point to the successor of a "
95-
"FUNCTION_CALL instruction");
96-
stack.emplace_back(edge.first, true);
97-
stack.emplace_back(
98-
cfg.entry_map[std::prev(node.PC)], caller_is_known);
92+
if(std::prev(node.PC)->is_function_call())
93+
{
94+
stack.emplace_back(edge.first, true);
95+
stack.emplace_back(
96+
cfg.entry_map[std::prev(node.PC)], caller_is_known);
97+
}
9998
}
10099
else if(pred_node.PC->is_function_call())
101100
{
@@ -196,11 +195,12 @@ void reachability_slicert::slice(goto_functionst &goto_functions)
196195
{
197196
Forall_goto_program_instructions(i_it, f_it->second.body)
198197
{
199-
const cfgt::nodet &e=cfg[cfg.entry_map[i_it]];
198+
cfgt::nodet &e = cfg[cfg.entry_map[i_it]];
200199
if(
201200
!e.reaches_assertion && !e.reachable_from_assertion &&
202201
!i_it->is_end_function())
203202
i_it->make_assumption(false_exprt());
203+
e.reaches_assertion = e.reachable_from_assertion = false;
204204
}
205205

206206
// replace unreachable code by skip

src/util/cmdline.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,18 @@ bool cmdlinet::parse(int argc, const char **argv, const char *optstring)
224224
}
225225
else
226226
options[*optnr].values.push_back(argv[i]+2);
227+
228+
auto &my_values = options[*optnr].values;
229+
if(my_values.back().find(':') != std::string::npos)
230+
{
231+
std::istringstream multiple_values(my_values.back());
232+
my_values.pop_back();
233+
std::string single_value;
234+
while(std::getline(multiple_values, single_value, ':'))
235+
{
236+
my_values.push_back(single_value);
237+
}
238+
}
227239
}
228240
}
229241
}

0 commit comments

Comments
 (0)