Skip to content

Commit 150c933

Browse files
authored
Merge pull request #2914 from polgreen/check_slicer_has_property
Throw error if reachability slicer has no slicing criteria
2 parents 107d5a8 + 676acfa commit 150c933

File tree

5 files changed

+39
-1
lines changed

5 files changed

+39
-1
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
void a()
2+
{
3+
}
4+
5+
int main()
6+
{
7+
a();
8+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
CORE
2+
main.c
3+
--reachability-slice
4+
^Reason: no slicing criterion found$
5+
^EXIT=1$
6+
^SIGNAL=0$
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
void a()
2+
{
3+
__CPROVER_assert(0, "");
4+
}
5+
6+
int main()
7+
{
8+
a();
9+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
CORE
2+
main.c
3+
--reachability-slice --property property-name-with-typo
4+
^Reason: no slicing criterion found$
5+
^EXIT=1$
6+
^SIGNAL=0$

src/goto-instrument/reachability_slicer.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ Author: Daniel Kroening, [email protected]
2222
#include <goto-programs/remove_skip.h>
2323
#include <goto-programs/remove_unreachable.h>
2424

25-
#include "util/message.h"
25+
#include <util/exception_utils.h>
26+
#include <util/message.h>
2627

2728
#include "full_slicer_class.h"
2829
#include "reachability_slicer_class.h"
@@ -46,6 +47,14 @@ reachability_slicert::get_sources(
4647
sources.push_back(e_it.second);
4748
}
4849

50+
if(sources.empty())
51+
{
52+
throw invalid_command_line_argument_exceptiont{
53+
"no slicing criterion found",
54+
"--property",
55+
"provide at least one property using --property <property>"};
56+
}
57+
4958
return sources;
5059
}
5160

0 commit comments

Comments
 (0)