Skip to content

Commit 2a64c19

Browse files
authored
Merge pull request #6876 from NlightNFotis/warn_allocated_memory_depracated
Add deprecation warning for intrinsic `__CPROVER_allocated_memory`
2 parents f34bf28 + ece1a84 commit 2a64c19

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

regression/cbmc/memory_allocation1/test.desc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ main.c
33
--pointer-check
44
^EXIT=10$
55
^SIGNAL=0$
6+
^\*\*\*\* WARNING: `__CPROVER_allocated_memory' in file main\.c line \d+ function main$
67
^\[main\.pointer_dereference\.2\] .* dereference failure: invalid integer address in \*p: SUCCESS$
78
^\[main\.assertion\.1\] .* assertion \*p==42: SUCCESS$
89
^\[main\.pointer_dereference\.[0-9]+\] .* dereference failure: invalid integer address in p\[.*1\]: FAILURE$

src/ansi-c/goto_check_c.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,17 @@ void goto_check_ct::collect_allocations(const goto_functionst &goto_functions)
436436
"allocated_memory")
437437
continue;
438438

439+
const auto function_line = function.source_location().as_string();
440+
log.warning() << "**** WARNING: `" CPROVER_PREFIX "allocated_memory' in "
441+
<< function_line << messaget::eom;
442+
log.warning() << "**** WARNING: `" CPROVER_PREFIX
443+
"allocated_memory' is "
444+
"deprecated and scheduled for deletion "
445+
<< "in version 6 and upwards." << messaget::eom;
446+
log.warning() << "Please avoid using this intrinsic. For more "
447+
"information, please check issue "
448+
<< "cbmc#6872 in Github" << messaget::eom;
449+
439450
const code_function_callt::argumentst &args =
440451
instruction.call_arguments();
441452
if(

0 commit comments

Comments
 (0)