File tree Expand file tree Collapse file tree 5 files changed +46
-6
lines changed
regression/goto-cc-goto-analyzer/reachable-functions-export-file-local-symbols Expand file tree Collapse file tree 5 files changed +46
-6
lines changed Original file line number Diff line number Diff line change 1+ static int foo (int x )
2+ {
3+ return x + 1 ;
4+ }
5+
6+ static int bar (int x )
7+ {
8+ return x + 2 ;
9+ }
Original file line number Diff line number Diff line change 1+ int __CPROVER_file_local_project_c_foo (int x );
2+
3+ int main ()
4+ {
5+ int x = __CPROVER_file_local_project_c_foo (1 );
6+ assert (x == 2 );
7+ }
Original file line number Diff line number Diff line change 1+ CORE
2+ test.c
3+ --reachable-functions
4+ ^.* foo 1 4$
5+ ^EXIT=0$
6+ ^SIGNAL=0$
7+ --
8+ ^.* [a-zA-Z0-9_]+foo \d+ \d+$
9+ --
10+ This test checks that after building the goto binary (see test.sh) with
11+ --export-file-local-symbols function "foo" is still reported as reachable. Note,
12+ that the symbol representing "foo" has a mangled name in the goto binary, which
13+ makes the symbol name different from its base name.
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ set -e
3+
4+ goto_cc=$1
5+ is_windows=$2
6+
7+ if [[ " ${is_windows} " == " true" ]]; then
8+ ${goto_cc} " /c" " /Foproject.gb" --export-file-local-symbols project.c
9+ ${goto_cc} " /c" " /Foproof.gb" --export-file-local-symbols proof.c
10+ ${goto_cc} " /Fetest.gb" project.gb proof.gb
11+ else
12+ ${goto_cc} -o project.gb --export-file-local-symbols project.c
13+ ${goto_cc} -o proof.gb --export-file-local-symbols proof.c
14+ ${goto_cc} -o test.gb project.gb proof.gb
15+ fi
Original file line number Diff line number Diff line change @@ -179,10 +179,8 @@ void unreachable_instructions(
179179
180180 const symbolt &decl = ns.lookup (gf_entry.first );
181181
182- // gf_entry.first may be a link-time renamed version, use the
183- // base_name instead; do not list inlined functions
184182 if (
185- called.find (decl.base_name ) != called.end () ||
183+ called.find (decl.name ) != called.end () ||
186184 to_code_type (decl.type ).get_inlined ())
187185 {
188186 unreachable_instructions (goto_program, dead_map);
@@ -314,10 +312,8 @@ static void list_functions(
314312 {
315313 const symbolt &decl = ns.lookup (gf_entry.first );
316314
317- // gf_entry.first may be a link-time renamed version, use the
318- // base_name instead; do not list inlined functions
319315 if (
320- unreachable == (called.find (decl.base_name ) != called.end () ||
316+ unreachable == (called.find (decl.name ) != called.end () ||
321317 to_code_type (decl.type ).get_inlined ()))
322318 {
323319 continue ;
You can’t perform that action at this time.
0 commit comments