File tree Expand file tree Collapse file tree 7 files changed +84
-4
lines changed Expand file tree Collapse file tree 7 files changed +84
-4
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ DIRS = cbmc \
25
25
goto-cc-goto-analyzer \
26
26
systemc \
27
27
contracts \
28
+ goto-cc-file-local \
28
29
# Empty last line
29
30
30
31
# Run all test directories in sequence
Original file line number Diff line number Diff line change
1
+ default : tests.log
2
+
3
+ include ../../src/config.inc
4
+ include ../../src/common
5
+
6
+ ifeq ($(BUILD_ENV_ ) ,MSVC)
7
+ exe=../../../src/goto-cc/goto-cl
8
+ is_windows=true
9
+ else
10
+ exe=../../../src/goto-cc/goto-cc
11
+ is_windows=false
12
+ endif
13
+
14
+ test :
15
+ @../test.pl -e -p -c ' ../chain.sh $(exe) ../../../src/goto-instrument/goto-instrument ../../../src/cbmc/cbmc $(is_windows)'
16
+
17
+ tests.log :
18
+ @../test.pl -e -p -c ' ../chain.sh $(exe) ../../../src/goto-instrument/goto-instrument ../../../src/cbmc/cbmc $(is_windows)'
19
+
20
+ show :
21
+ @for dir in * ; do \
22
+ if [ -d " $$ dir" ]; then \
23
+ vim -o " $$ dir/*.c" " $$ dir/*.out" ; \
24
+ fi ; \
25
+ done ;
26
+
27
+ clean :
28
+ @for dir in * ; do \
29
+ $(RM ) tests.log; \
30
+ if [ -d " $$ dir" ]; then \
31
+ cd " $$ dir" ; \
32
+ $(RM ) * .out * .gb; \
33
+ cd ..; \
34
+ fi \
35
+ done
Original file line number Diff line number Diff line change 4
4
#
5
5
# Author: Kareem Khazem <[email protected] >
6
6
7
+ set -e
8
+
7
9
is_in ()
8
10
{
9
11
[[ " $2 " =~ $1 ]] && return 0 || return 1
81
83
82
84
if is_in final-link " $ALL_ARGS " ; then
83
85
OUT_FILE=final-link.gb
86
+ rm -f ${OUT_FILE}
84
87
if [[ " ${is_windows} " == " true" ]]; then
85
88
" ${goto_cc} " \
86
89
--export-function-local-symbols \
Original file line number Diff line number Diff line change
1
+ #include <assert.h>
2
+
3
+ static int foo ()
4
+ {
5
+ return 3 ;
6
+ }
7
+
8
+ int (* fptrs [])(void ) = {foo };
9
+
10
+ int main ()
11
+ {
12
+ int x = fptrs [0 ]();
13
+ assert (x == 3 );
14
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ main.c
3
+ final-link assertion-check
4
+ ^VERIFICATION SUCCESSFUL$
5
+ ^EXIT=0$
6
+ ^SIGNAL=0$
7
+ --
8
+ ^warning: ignoring
9
+ ^\*\*\*\* WARNING: no body for function
Original file line number Diff line number Diff line change @@ -84,6 +84,20 @@ class function_name_manglert
84
84
for (const auto &sym : old_syms)
85
85
model.symbol_table .erase (sym);
86
86
87
+ for (const auto &sym_pair : model.symbol_table )
88
+ {
89
+ const symbolt &sym = sym_pair.second ;
90
+
91
+ exprt e = sym.value ;
92
+ typet t = sym.type ;
93
+ if (rename (e) && rename (t))
94
+ continue ;
95
+
96
+ symbolt &new_sym = model.symbol_table .get_writeable_ref (sym.name );
97
+ new_sym.value = e;
98
+ new_sym.type = t;
99
+ }
100
+
87
101
for (auto &fun : model.goto_functions .function_map )
88
102
{
89
103
if (!fun.second .body_available ())
Original file line number Diff line number Diff line change @@ -43,14 +43,18 @@ class rename_symbolt
43
43
type_map.insert (std::pair<irep_idt, irep_idt>(old_id, new_id));
44
44
}
45
45
46
- void operator ()(exprt &dest) const
46
+ // / Rename symbols in \p dest.
47
+ // / \return True if, and only if, the expression was not modified.
48
+ bool operator ()(exprt &dest) const
47
49
{
48
- rename (dest);
50
+ return rename (dest);
49
51
}
50
52
51
- void operator ()(typet &dest) const
53
+ // / Rename symbols in \p dest.
54
+ // / \return True if, and only if, the type was not modified.
55
+ bool operator ()(typet &dest) const
52
56
{
53
- rename (dest);
57
+ return rename (dest);
54
58
}
55
59
56
60
rename_symbolt ();
You can’t perform that action at this time.
0 commit comments