Skip to content

Commit 243a31b

Browse files
committed
goto-symex/concurrency: limit unsoundness-abort to dereferencing shared pointers
Reading and writing pointers is not not itself unsound, only the interaction with value sets may cause unsound results. Hence, do not reject programs that never dereference a shared pointer. Fixes: #8714 Fixes: #7957
1 parent 76b5d2b commit 243a31b

File tree

20 files changed

+100
-93
lines changed

20 files changed

+100
-93
lines changed

regression/book-examples/account/C10.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
KNOWNBUG
1+
CORE no-new-smt gcc-only
22
account.c
33

44
^EXIT=10$

regression/cbmc-concurrency/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
if((NOT WIN32) AND (NOT APPLE) AND (NOT (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")))
1+
if(NOT WIN32)
22
add_test_pl_tests(
33
"$<TARGET_FILE:cbmc> --validate-goto-model --validate-ssa-equation"
44
)

regression/cbmc-concurrency/Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@ default: tests.log
33
include ../../src/config.inc
44
include ../../src/common
55

6-
ifeq ($(filter-out OSX MSVC FreeBSD,$(BUILD_ENV_)),)
6+
ifeq ($(filter-out MSVC,$(BUILD_ENV_)),)
77
# no POSIX threads on Windows
8-
# for OSX and FreeBSD we'd need sound handling of pointers in multi-threaded programs
98
no_pthread = -X pthread
109
endif
1110

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
CORE
22
main.c
33
--no-standard-checks
4-
^EXIT=10$
4+
pointer handling for concurrency is unsound
5+
^EXIT=6$
56
^SIGNAL=0$
6-
^VERIFICATION FAILED$
77
--
88
^warning: ignoring
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE pthread
2+
main.c
3+
4+
pointer handling for concurrency is unsound
5+
^EXIT=6$
6+
^SIGNAL=0$
7+
--
8+
^warning: ignoring

regression/cbmc-concurrency/global_pointer1/main.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ void *thread1(void * arg)
1212
void *thread2(void *arg)
1313
{
1414
assert(v == &g);
15+
#ifndef NO_DEREF
1516
*v = 1;
17+
#endif
1618
}
1719

1820
int main()
@@ -26,7 +28,9 @@ int main()
2628
pthread_join(t2, 0);
2729

2830
assert(v == &g);
31+
#ifndef NO_DEREF
2932
assert(*v == 1);
33+
#endif
3034

3135
return 0;
3236
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
KNOWNBUG pthread
2+
main.c
3+
-DNO_DEREF
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^VERIFICATION SUCCESSFUL$
7+
--
8+
^warning: ignoring
9+
--
10+
Simplification with value sets causes unsound results despite the absence of
11+
dereferencing.

regression/cbmc-concurrency/global_pointer1/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
KNOWNBUG
1+
KNOWNBUG pthread
22
main.c
33

44
^EXIT=0$
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
CORE
22
main.c
33
--no-malloc-may-fail
4-
^EXIT=0$
4+
pointer handling for concurrency is unsound
5+
^EXIT=6$
56
^SIGNAL=0$
6-
^VERIFICATION SUCCESSFUL$
77
--
88
^warning: ignoring
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
CORE
22
main.c
33
--no-malloc-may-fail
4-
^EXIT=0$
4+
pointer handling for concurrency is unsound
5+
^EXIT=6$
56
^SIGNAL=0$
6-
^VERIFICATION SUCCESSFUL$
77
--
88
^warning: ignoring

0 commit comments

Comments
 (0)