Skip to content

Commit cc8321e

Browse files
authored
Merge pull request #6498 from tautschnig/setjmp-overapprox
C library: model currently supported behaviour of longjmp
2 parents 1e8e495 + 6e47d5a commit cc8321e

File tree

40 files changed

+159
-59
lines changed

40 files changed

+159
-59
lines changed

regression/cbmc-library/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ add_test_pl_tests(
77
"$<TARGET_FILE:cbmc>"
88
"cbmc-library"
99
"$<TARGET_FILE:cbmc>"
10-
"-C;-X;pthread"
10+
"-C;-X;unix"
1111
"CORE"
1212
)
1313
endif()

regression/cbmc-library/Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ include ../../src/config.inc
44
include ../../src/common
55

66
ifeq ($(BUILD_ENV_),MSVC)
7-
no_pthread = -X pthread
7+
unix_only = -X unix
88
endif
99

1010
test:
11-
@../test.pl -e -p -c ../../../src/cbmc/cbmc $(no_pthread)
11+
@../test.pl -e -p -c ../../../src/cbmc/cbmc $(unix_only)
1212

1313
tests.log: ../test.pl
14-
@../test.pl -e -p -c ../../../src/cbmc/cbmc $(no_pthread)
14+
@../test.pl -e -p -c ../../../src/cbmc/cbmc $(unix_only)
1515

1616
clean:
1717
find . -name '*.out' -execdir $(RM) '{}' \;
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
#include <assert.h>
21
#include <setjmp.h>
32

3+
static jmp_buf env;
4+
45
int main()
56
{
6-
_longjmp();
7-
assert(0);
7+
_longjmp(env, 1);
8+
__CPROVER_assert(0, "unreachable");
89
return 0;
910
}
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
KNOWNBUG
1+
CORE
22
main.c
33
--pointer-check --bounds-check
4-
^EXIT=0$
4+
^\[_longjmp.assertion.1\] line 12 _longjmp requires instrumentation: FAILURE$
5+
^\[main.assertion.1\] line 8 unreachable: SUCCESS$
6+
^VERIFICATION FAILED$
7+
^EXIT=10$
58
^SIGNAL=0$
6-
^VERIFICATION SUCCESSFUL$
79
--
810
^warning: ignoring
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
#include <assert.h>
21
#include <setjmp.h>
32

3+
static jmp_buf env;
4+
45
int main()
56
{
6-
longjmp();
7-
assert(0);
7+
longjmp(env, 1);
8+
__CPROVER_assert(0, "unreachable");
89
return 0;
910
}
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
KNOWNBUG
1+
CORE
22
main.c
33
--pointer-check --bounds-check
4-
^EXIT=0$
4+
^\[longjmp.assertion.1\] line 12 longjmp requires instrumentation: FAILURE$
5+
^\[main.assertion.1\] line 8 unreachable: SUCCESS$
6+
^VERIFICATION FAILED$
7+
^EXIT=10$
58
^SIGNAL=0$
6-
^VERIFICATION SUCCESSFUL$
79
--
810
^warning: ignoring

regression/cbmc-library/pthread_barrier_destroy-01/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
KNOWNBUG pthread
1+
KNOWNBUG unix
22
main.c
33
--pointer-check --bounds-check
44
^EXIT=0$

regression/cbmc-library/pthread_barrier_init-01/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
KNOWNBUG pthread
1+
KNOWNBUG unix
22
main.c
33
--pointer-check --bounds-check
44
^EXIT=0$

regression/cbmc-library/pthread_barrier_wait-01/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
KNOWNBUG pthread
1+
KNOWNBUG unix
22
main.c
33
--pointer-check --bounds-check
44
^EXIT=0$

regression/cbmc-library/pthread_cancel-01/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
KNOWNBUG pthread
1+
KNOWNBUG unix
22
main.c
33
--pointer-check --bounds-check
44
^EXIT=0$

0 commit comments

Comments
 (0)