File tree Expand file tree Collapse file tree 3 files changed +38
-10
lines changed
regression/ansi-c/static5 Expand file tree Collapse file tree 3 files changed +38
-10
lines changed Original file line number Diff line number Diff line change
1
+ typedef struct vtable_s
2
+ {
3
+ int (* f )(void );
4
+ } vtable_t ;
5
+
6
+ int return_0 ()
7
+ {
8
+ return 0 ;
9
+ }
10
+
11
+ static vtable_t vtable_0 = {.f = & return_0 };
12
+
13
+ void foo (vtable_t * vtable )
14
+ __CPROVER_requires ((void * )0 == vtable || & vtable_0 == vtable )
15
+ {
16
+ if (vtable -> f )
17
+ vtable -> f ();
18
+ }
19
+
20
+ int main ()
21
+ {
22
+ vtable_t * vtable ;
23
+ foo (vtable );
24
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ main.c
3
+ --verbosity 10
4
+ ^Removing unused symbol
5
+ ^EXIT=0$
6
+ ^SIGNAL=0$
7
+ --
8
+ ^Removing unused symbol vtable_0$
Original file line number Diff line number Diff line change @@ -76,16 +76,11 @@ static void get_symbols(
76
76
77
77
for (const auto &s : new_symbols)
78
78
{
79
- // keep functions called in contracts within scope.
80
- // should we keep local variables from the contract as well?
81
- const symbolt *new_symbol = nullptr ;
82
- if (!ns.lookup (s, new_symbol))
83
- {
84
- if (new_symbol->type .id () == ID_code)
85
- {
86
- working_set.push_back (new_symbol);
87
- }
88
- }
79
+ const symbolt *symbol_ptr;
80
+ // identifiers for parameters of prototypes need not exist, and neither
81
+ // does __CPROVER_return_value
82
+ if (!ns.lookup (s, symbol_ptr))
83
+ working_set.push_back (symbol_ptr);
89
84
}
90
85
}
91
86
}
@@ -239,6 +234,7 @@ void remove_internal_symbols(
239
234
if (exported.find (it->first )==exported.end ())
240
235
{
241
236
symbol_table_baset::symbolst::const_iterator next = std::next (it);
237
+ log.debug () << " Removing unused symbol " << it->first << messaget::eom;
242
238
symbol_table.erase (it);
243
239
it=next;
244
240
}
You can’t perform that action at this time.
0 commit comments