Skip to content

Commit 92b92d6

Browse files
author
martin
committed
Correct the documentation of ASSERT : it does not alter control flow.
After a discussion on issue diffblue#2031, this was agreed to be the correct semantics for the following reasons: 1. We want to check for conditions that do not result in termination. For example, generation of Inf and NaN, reachability of locations and unsigned overflow / underflow, error locations, exceptions or the use of program approximations. This is particularly important for binary analysis and security. 2. Allowing traces with multiple assertion failures reduces the number of solver calls and test cases generated, allowing minimisation without complex program manipulation. 3. If ASSERT alters control flow then the truth of assertions can change as more assertions are added, as the failures may get blocked. Adding more checks can result in less failures. 4. If ASSERT alters control flow, then it must be taken into account when slicing, meaning that every variable in any assert must be part of the slice. 5. ASSUME allows arbitrary blocking of execution, it is better than ASSERT is orthogonal and: ASSERT(X) ASSUME(X) is used for cases where assertion failure results in termination (such as null pointer dereference or array bounds failures).
1 parent a11add8 commit 92b92d6

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/goto-programs/goto_program.h

+3-2
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,9 @@ class goto_programt
134134
/// Assume does not "retro-actively" affect the thread or any ASSERTs.
135135
/// - ASSERT:
136136
/// Using ASSERT instructions is the one and only way to express
137-
/// properties to be verified. Execution paths abort if `guard` evaluates
138-
/// to false.
137+
/// properties to be verified. An assertion is true / safe if `guard`
138+
/// is true in all possible executions, otherwise it is false / unsafe.
139+
/// The status of the assertion does not affect execution in any way.
139140
/// - SKIP, LOCATION:
140141
/// No-op.
141142
/// - ATOMIC_BEGIN, ATOMIC_END:

0 commit comments

Comments
 (0)