Skip to content
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
9 changes: 9 additions & 0 deletions regression/contracts/entry_point/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
int foo(char *arr, unsigned int size)
// clang-format off
__CPROVER_requires(__CPROVER_is_fresh(arr, size))
__CPROVER_assigns(arr &&size > 0: arr[0])
// clang-format on
{
if(arr && size > 0)
arr[0] = 1;
}
10 changes: 10 additions & 0 deletions regression/contracts/entry_point/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
CORE
main.c
--enforce-contract foo _ --function foo
^EXIT=0$
^SIGNAL=0$
^VERIFICATION SUCCESSFUL$
--
--
This test checks that we can use a function with a contract as entry point
for the analysis when its contract gets enforced.
2 changes: 1 addition & 1 deletion src/ansi-c/ansi_c_entry_point.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ bool ansi_c_entry_point(
if(s_it==symbol_table.symbols.end())
continue;

if(s_it->second.type.id()==ID_code)
if(s_it->second.type.id() == ID_code && !s_it->second.is_property)
matches.push_back(symbol_name_entry.second);
}

Expand Down
4 changes: 2 additions & 2 deletions src/ansi-c/c_typecheck_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -877,8 +877,8 @@ void c_typecheck_baset::typecheck_declaration(
// create a contract symbol
symbolt contract;
contract.name = "contract::" + id2string(new_symbol.name);
contract.base_name = new_symbol.name;
contract.pretty_name = new_symbol.name;
contract.base_name = new_symbol.base_name;
contract.pretty_name = new_symbol.pretty_name;
contract.is_property = true;
contract.type = code_type;
contract.mode = new_symbol.mode;
Expand Down
2 changes: 1 addition & 1 deletion src/goto-instrument/interrupt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ get_isr(const symbol_tablet &symbol_table, const irep_idt &interrupt_handler)
if(s_it==symbol_table.symbols.end())
continue;

if(s_it->second.type.id()==ID_code)
if(s_it->second.type.id() == ID_code && !s_it->second.is_property)
matches.push_back(s_it->second.symbol_expr());
}

Expand Down
2 changes: 1 addition & 1 deletion src/jsil/jsil_entry_point.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ bool jsil_entry_point(
if(s_it==symbol_table.symbols.end())
continue;

if(s_it->second.type.id()==ID_code)
if(s_it->second.type.id() == ID_code && !s_it->second.is_property)
matches.push_back(symbol_name_entry.second);
}

Expand Down