Skip to content

Commit 0914275

Browse files
authored
Merge pull request #2905 from NlightNFotis/2814_takeover
Cleanup of throws and asserts of goto_convert.cpp
2 parents 974a0e3 + 5523818 commit 0914275

File tree

17 files changed

+262
-222
lines changed

17 files changed

+262
-222
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
int main()
2+
{
3+
break;
4+
return 0;
5+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
main.c
3+
4+
^EXIT=1$
5+
^SIGNAL=0$
6+
^CONVERSION ERROR$
7+
--
8+
^warning: ignoring
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
int main()
2+
{
3+
continue;
4+
return 0;
5+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
main.c
3+
4+
^EXIT=1$
5+
^SIGNAL=0$
6+
^CONVERSION ERROR$
7+
--
8+
^warning: ignoring
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
int main()
2+
{
3+
goto x;
4+
5+
// x:
6+
7+
return 0;
8+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
main.c
3+
4+
^CONVERSION ERROR$
5+
^EXIT=1$
6+
^SIGNAL=0$
7+
--
8+
^warning: ignoring
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
int main()
2+
{
3+
int x;
4+
int n = 5;
5+
switch(x)
6+
{
7+
case 0 ... n:
8+
break;
9+
default:
10+
break;
11+
}
12+
return 0;
13+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
main.c
3+
4+
^CONVERSION ERROR$
5+
^EXIT=1$
6+
^SIGNAL=0$
7+
--
8+
^warning: ignoring
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#include <assert.h>
2+
3+
#define false 0
4+
5+
int main(void)
6+
{
7+
int x = 5;
8+
switch (x)
9+
{
10+
case 0 ... 10:
11+
break;
12+
default:
13+
assert(false);
14+
break;
15+
}
16+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
main.c
3+
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
--
7+
^warning: ignoring
8+
^Invariant check failed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
int main()
2+
{
3+
int x;
4+
switch(x)
5+
{
6+
case 10 ... 0:
7+
break;
8+
default:
9+
break;
10+
}
11+
return 0;
12+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
KNOWNBUG
2+
main.c
3+
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
--
7+
^warning: ignoring
8+
^Invariant check failed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
int main()
2+
{
3+
int x;
4+
switch(x)
5+
{
6+
case 0 ... 10 20:
7+
break;
8+
default:
9+
break;
10+
}
11+
return 0;
12+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
main.c
3+
4+
^EXIT=1$
5+
^SIGNAL=0$
6+
^PARSING ERROR$
7+
--
8+
^warning: ignoring

src/cbmc/cbmc_parse_options.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Author: Daniel Kroening, [email protected]
1717
#include <memory>
1818

1919
#include <util/config.h>
20+
#include <util/exception_utils.h>
2021
#include <util/exit_codes.h>
2122
#include <util/invariant.h>
2223
#include <util/unicode.h>
@@ -611,6 +612,12 @@ int cbmc_parse_optionst::get_goto_program(
611612
log.status() << config.object_bits_info() << log.eom;
612613
}
613614

615+
catch(incorrect_goto_program_exceptiont &e)
616+
{
617+
log.error() << e.what() << log.eom;
618+
return CPROVER_EXIT_EXCEPTION;
619+
}
620+
614621
catch(const char *e)
615622
{
616623
log.error() << e << log.eom;

0 commit comments

Comments
 (0)