-
Notifications
You must be signed in to change notification settings - Fork 280
[SV-COMP'18 13/19] Memcpy assertions #2002
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
555451c
More precise assertion in memcpy about overlap of src/dst memory.
marek-trtik b228fe4
SV-COMP Hotfix: memcpy - turning assert to assume to prever 3 RED re…
marek-trtik ec25788
use __CPROVER_size_t and __CPROVER_ssize_t for __CPROVER_POINTER_OBJE…
kroening 8b65d37
use __CPROVER_size_t and __CPROVER_ssize_t for __CPROVER_POINTER_OBJE…
kroening File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ Author: Daniel Kroening, [email protected] | |
|
||
#include "ansi_c_internal_additions.h" | ||
|
||
#include <util/c_types.h> | ||
#include <util/config.h> | ||
|
||
const char gcc_builtin_headers_types[]= | ||
|
@@ -124,13 +125,24 @@ void ansi_c_internal_additions(std::string &code) | |
code+= | ||
"# 1 \"<built-in-additions>\"\n" | ||
"typedef __typeof__(sizeof(int)) __CPROVER_size_t;\n" | ||
"typedef "+c_type_as_string(signed_size_type().get(ID_C_c_type))+ | ||
" __CPROVER_ssize_t;\n" | ||
"const unsigned __CPROVER_constant_infinity_uint;\n" | ||
"typedef void __CPROVER_integer;\n" | ||
"typedef void __CPROVER_rational;\n" | ||
"__CPROVER_thread_local unsigned long __CPROVER_thread_id=0;\n" | ||
// NOLINTNEXTLINE(whitespace/line_length) | ||
"__CPROVER_bool __CPROVER_threads_exited[__CPROVER_constant_infinity_uint];\n" | ||
"unsigned long __CPROVER_next_thread_id=0;\n" | ||
|
||
// traces | ||
"void CBMC_trace(int lvl, const char *event, ...);\n" | ||
|
||
// pointers | ||
"__CPROVER_size_t __CPROVER_POINTER_OBJECT(const void *);\n" | ||
"__CPROVER_ssize_t __CPROVER_POINTER_OFFSET(const void *);\n" | ||
"__CPROVER_bool __CPROVER_DYNAMIC_OBJECT(const void *);\n" | ||
"extern unsigned char __CPROVER_memory[__CPROVER_constant_infinity_uint];\n" | ||
// NOLINTNEXTLINE(whitespace/line_length) | ||
"extern unsigned char __CPROVER_memory[__CPROVER_constant_infinity_uint];\n" | ||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ Author: Daniel Kroening, [email protected] | |
#define CPROVER_ANSI_C_LIBRARY_CPROVER_H | ||
|
||
typedef __typeof__(sizeof(int)) __CPROVER_size_t; | ||
typedef signed long long __CPROVER_size_t; | ||
void *__CPROVER_allocate(__CPROVER_size_t size, __CPROVER_bool zero); | ||
extern const void *__CPROVER_deallocated; | ||
extern const void *__CPROVER_malloc_object; | ||
|
@@ -53,9 +54,9 @@ void CBMC_trace(int lvl, const char *event, ...); | |
#endif | ||
|
||
// pointers | ||
unsigned __CPROVER_POINTER_OBJECT(const void *p); | ||
signed __CPROVER_POINTER_OFFSET(const void *p); | ||
__CPROVER_bool __CPROVER_DYNAMIC_OBJECT(const void *p); | ||
__CPROVER_size_t __CPROVER_POINTER_OBJECT(const void *); | ||
__CPROVER_ssize_t __CPROVER_POINTER_OFFSET(const void *); | ||
__CPROVER_bool __CPROVER_DYNAMIC_OBJECT(const void *); | ||
#if 0 | ||
extern unsigned char __CPROVER_memory[__CPROVER_constant_infinity_uint]; | ||
void __CPROVER_allocated_memory( | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ Author: Daniel Kroening, [email protected] | |
|
||
#include <ostream> | ||
|
||
#include <util/c_types.h> | ||
#include <util/config.h> | ||
|
||
#include <ansi-c/ansi_c_internal_additions.h> | ||
|
@@ -62,7 +63,11 @@ void cpp_internal_additions(std::ostream &out) | |
|
||
// types | ||
out << "typedef __typeof__(sizeof(int)) __CPROVER::size_t;" << '\n'; | ||
out << "typedef __typeof__(sizeof(int)) __CPROVER_size_t;" << '\n'; | ||
out << "typedef __CPROVER::size_t __CPROVER_size_t;" << '\n'; | ||
out << "typedef " | ||
<< c_type_as_string(signed_size_type().get(ID_C_c_type)) | ||
<< " __CPROVER::ssize_t;" << '\n'; | ||
out << "typedef __CPROVER::ssize_t __CPROVER_ssize_t;" << '\n'; | ||
|
||
// assume/assert | ||
out << "extern \"C\" void assert(bool assertion);" << '\n'; | ||
|
@@ -83,9 +88,9 @@ void cpp_internal_additions(std::ostream &out) | |
out << "extern \"C\" void __CPROVER::atomic_end();" << '\n'; | ||
|
||
// pointers | ||
out << "extern \"C\" unsigned __CPROVER_POINTER_OBJECT(const void *p);\n"; | ||
out << "extern \"C\" signed __CPROVER_POINTER_OFFSET(const void *p);" << '\n'; | ||
out << "extern \"C\" bool __CPROVER_DYNAMIC_OBJECT(const void *p);" << '\n'; | ||
out << "extern \"C\" __CPROVER::size_t __CPROVER_POINTER_OBJECT(const void *);\n"; | ||
out << "extern \"C\" __CPROVER::ssize_t __CPROVER_POINTER_OFFSET(const void *);" << '\n'; | ||
out << "extern \"C\" bool __CPROVER_DYNAMIC_OBJECT(const void *);" << '\n'; | ||
// NOLINTNEXTLINE(whitespace/line_length) | ||
out << "extern \"C\" extern unsigned char __CPROVER_memory[__CPROVER::constant_infinity_uint];" << '\n'; | ||
out << "extern \"C\" const void *__CPROVER_dead_object=0;" << '\n'; | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The precondition needs to be at the head of the function!