Skip to content

Add deprecation warning for intrinsic __CPROVER_allocated_memory #6876

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions regression/cbmc/memory_allocation1/test.desc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ main.c
--pointer-check
^EXIT=10$
^SIGNAL=0$
^\*\*\*\* WARNING: `__CPROVER_allocated_memory' in file main\.c line \d+ function main$
^\[main\.pointer_dereference\.2\] .* dereference failure: invalid integer address in \*p: SUCCESS$
^\[main\.assertion\.1\] .* assertion \*p==42: SUCCESS$
^\[main\.pointer_dereference\.[0-9]+\] .* dereference failure: invalid integer address in p\[.*1\]: FAILURE$
Expand Down
11 changes: 11 additions & 0 deletions src/ansi-c/goto_check_c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,17 @@ void goto_check_ct::collect_allocations(const goto_functionst &goto_functions)
"allocated_memory")
continue;

const auto function_line = function.source_location().as_string();
log.warning() << "**** WARNING: `" CPROVER_PREFIX "allocated_memory' in "
<< function_line << messaget::eom;
log.warning() << "**** WARNING: `" CPROVER_PREFIX
"allocated_memory' is "
"deprecated and scheduled for deletion "
<< "in version 6 and upwards." << messaget::eom;
log.warning() << "Please avoid using this intrinsic. For more "
"information, please check issue "
<< "cbmc#6872 in Github" << messaget::eom;

const code_function_callt::argumentst &args =
instruction.call_arguments();
if(
Expand Down