Skip to content

Commit c362a26

Browse files
authored
Merge pull request #660 from peterschrammel/pull-from-master
Update test-gen-support from master
2 parents c337363 + aa8c91e commit c362a26

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+2294
-339
lines changed

.gitignore

+11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
# Local files generated by IDEs
2+
.vs/*
23
.vscode/*
4+
~AutoRecover.*
5+
*.sln
6+
*.vcxproj*
7+
scripts/__pycache__/*
8+
src/goto-analyzer/taint_driver_scripts/.idea/*
9+
/*.config
10+
/*.creator
11+
/*.creator.user
12+
/*.files
13+
/*.includes
314

415
# compilation files
516
*.lo

COMPILING

+9-9
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ environments:
1010

1111
- Solaris 11
1212

13-
- FreeBSD 10 or 11
13+
- FreeBSD 11
1414

1515
- Cygwin
16-
(We recommend the i686-pc-mingw32-g++ cross compiler, version 4.7 or above.)
16+
(We recommend the i686-pc-mingw32-g++ cross compiler, version 5.4 or above.)
1717

1818
- Microsoft's Visual Studio version 12 (2013), version 14 (2015),
1919
or version 15 (older versions won't work)
@@ -29,16 +29,16 @@ COMPILATION ON LINUX
2929
We assume that you have a Debian/Ubuntu or Red Hat-like distribution.
3030

3131
0) You need a C/C++ compiler, Flex and Bison, and GNU make.
32-
The GNU Make needs to be version 3.81 or higher. On Debian-like
33-
distributions, do
32+
The GNU Make needs to be version 3.81 or higher.
33+
On Debian-like distributions, do
3434

35-
apt-get install g++ gcc flex bison make git libz-dev libwww-perl patch libzip-dev
35+
apt-get install g++-6 gcc flex bison make git libwww-perl patch
3636

3737
On Red Hat/Fedora or derivates, do
3838

3939
yum install gcc gcc-c++ flex bison perl-libwww-perl patch
4040

41-
Note that you need g++ version 4.9 or newer.
41+
Note that you need g++ version 5.2 or newer.
4242

4343
1) As a user, get the CBMC source via
4444

@@ -57,7 +57,7 @@ COMPILATION ON SOLARIS 11
5757
1) As root, get the necessary development tools:
5858

5959
pkg install system/header developer/lexer/flex developer/parser/bison developer/versioning/git
60-
pkg install --accept developer/gcc-49
60+
pkg install --accept developer/gcc-5
6161

6262
2) As a user, get the CBMC source via
6363

@@ -83,8 +83,8 @@ COMPILATION ON SOLARIS 11
8383
It will mis-optimize MiniSat2.
8484

8585

86-
COMPILATION ON FREEBSD 10/11
87-
----------------------------
86+
COMPILATION ON FREEBSD 11
87+
-------------------------
8888

8989
1) As root, get the necessary tools:
9090

regression/cbmc-java/VarLengthArrayTrace1/test.desc

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ VarLengthArrayTrace1.class
33
--trace
44
^EXIT=10$
55
^SIGNAL=0$
6-
dynamic_3_array\[1l\]=10
6+
dynamic_3_array\[1.*\]=10
77
--
88
^warning: ignoring
99
assignment removed
351 Bytes
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
public class classtest1
2+
{
3+
static void main(String[] args)
4+
{
5+
g(classtest1.class);
6+
}
7+
static void g(Object c)
8+
{
9+
assert true;
10+
}
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
classtest1.class
3+
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^VERIFICATION SUCCESSFUL$
7+
--
8+
^warning: ignoring

regression/cbmc/Malloc23/test.desc

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ main.c
55
^SIGNAL=0$
66
pointer outside dynamic object bounds in \*p: FAILURE
77
pointer outside dynamic object bounds in \*p: FAILURE
8-
pointer outside dynamic object bounds in p2\[\(signed long int\)1\]: FAILURE
9-
pointer outside dynamic object bounds in p2\[\(signed long int\)0\]: FAILURE
8+
pointer outside dynamic object bounds in p2\[.*1\]: FAILURE
9+
pointer outside dynamic object bounds in p2\[.*0\]: FAILURE
1010
\*\* 4 of 36 failed \(3 iterations\)
1111
--
1212
^warning: ignoring

regression/cbmc/byte_update2/main.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ int main(int argc, char** argv) {
66
if(argc != 2)
77
return 0;
88

9-
unsigned long x[argc];
9+
unsigned long long x[argc];
1010
x[0]=0x0102030405060708;
1111
x[1]=0x1112131415161718;
1212

regression/cbmc/byte_update3/main.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ int main(int argc, char** argv) {
1313
x[3]=0x0708;
1414
x[4]=0x090a;
1515

16-
unsigned long* alias=(unsigned long*)(((char*)x)+0);
16+
unsigned long long* alias=(unsigned long long*)(((char*)x)+0);
1717
*alias=0xf1f2f3f4f5f6f7f8;
1818

1919
unsigned char* alias2=(unsigned char*)x;

regression/cbmc/byte_update4/main.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ int main(int argc, char** argv) {
1818
x[8]=0x09;
1919
x[9]=0x0a;
2020

21-
unsigned long* alias=(unsigned long*)(((char*)x)+1);
21+
unsigned long long* alias=(unsigned long long*)(((char*)x)+1);
2222
*alias=0xf1f2f3f4f5f6f7f8;
2323

2424
unsigned char* alias2=(unsigned char*)x;

regression/cbmc/byte_update5/main.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ int main(int argc, char** argv) {
1313
x[3]=0x0708;
1414
x[4]=0x090a;
1515

16-
unsigned long* alias=(unsigned long*)(((char*)x)+1);
16+
unsigned long long* alias=(unsigned long long*)(((char*)x)+1);
1717
*alias=0xf1f2f3f4f5f6f7f8;
1818

1919
unsigned char* alias2=(unsigned char*)x;

regression/cbmc/byte_update6/main.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ int main(int argc, char** argv) {
66
if(argc != 2)
77
return 0;
88

9-
unsigned long x[argc];
9+
unsigned long long x[argc];
1010
x[0]=0x0102030405060708;
1111
x[1]=0x1112131415161718;
1212

regression/cbmc/byte_update7/main.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ int main(int argc, char** argv) {
66
if(argc != 2)
77
return 0;
88

9-
unsigned long x[argc];
9+
unsigned long long x[argc];
1010
x[0]=0x0102030405060708;
1111
x[1]=0x1112131415161718;
1212

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
2+
int x;
3+
4+
void g()
5+
{
6+
x = 1;
7+
}
8+
9+
void f()
10+
{
11+
g();
12+
}
13+
14+
int main()
15+
{
16+
f();
17+
}
18+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
main.c
3+
--function-inline main --log -
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^VERIFICATION SUCCESSFUL$
7+
--
8+
^warning: ignoring
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
2+
int x;
3+
4+
void h()
5+
{
6+
x = 1;
7+
}
8+
9+
void g()
10+
{
11+
h();
12+
}
13+
14+
void f()
15+
{
16+
g();
17+
}
18+
19+
int main()
20+
{
21+
f();
22+
}
23+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
main.c
3+
--function-inline main --log - --no-caching
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^VERIFICATION SUCCESSFUL$
7+
--
8+
^warning: ignoring
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
2+
int x;
3+
4+
void h()
5+
{
6+
x = 1;
7+
}
8+
9+
void g()
10+
{
11+
h();
12+
}
13+
14+
void f()
15+
{
16+
g();
17+
}
18+
19+
int main()
20+
{
21+
f();
22+
}
23+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
main.c
3+
--function-inline main --log - --no-caching --verbosity 9
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^VERIFICATION SUCCESSFUL$
7+
--
8+
^warning: ignoring

regression/goto-instrument/slice02/test.desc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
KNOWNBUG
1+
CORE
22
main.c
33
--pointer-check --full-slice
44
^EXIT=0$

regression/goto-instrument/slice14/test.desc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
KNOWNBUG
1+
CORE
22
main.c
33
--pointer-check --full-slice
44
^EXIT=10$

regression/goto-instrument/slice16/test.desc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CORE
1+
KNOWNBUG
22
main.c
33
--full-slice --unwind 2
44
^EXIT=0$

scripts/filter_lint_by_diff.py

+13-14
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,19 @@
1111
added_lines = set()
1212
repository_root = sys.argv[2]
1313

14-
with open(sys.argv[1], "r") as f:
15-
diff = unidiff.PatchSet(f)
16-
for diff_file in diff:
17-
filename = diff_file.target_file
18-
# Skip files deleted in the tip (b side of the diff):
19-
if filename == "/dev/null":
20-
continue
21-
assert filename.startswith("b/")
22-
filename = os.path.join(repository_root, filename[2:])
23-
added_lines.add((filename, 0))
24-
for diff_hunk in diff_file:
25-
for diff_line in diff_hunk:
26-
if diff_line.line_type == "+":
27-
added_lines.add((filename, diff_line.target_line_no))
14+
diff = unidiff.PatchSet.from_filename(sys.argv[1])
15+
for diff_file in diff:
16+
filename = diff_file.target_file
17+
# Skip files deleted in the tip (b side of the diff):
18+
if filename == "/dev/null":
19+
continue
20+
assert filename.startswith("b/")
21+
filename = os.path.join(repository_root, filename[2:])
22+
added_lines.add((filename, 0))
23+
for diff_hunk in diff_file:
24+
for diff_line in diff_hunk:
25+
if diff_line.line_type == "+":
26+
added_lines.add((filename, diff_line.target_line_no))
2827

2928
for l in sys.stdin:
3029
bits = l.split(":")

src/analyses/dependence_graph.cpp

+33-19
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ void dep_graph_domaint::control_dependencies(
9494
from->is_assume())
9595
control_deps.insert(from);
9696

97+
const irep_idt id=goto_programt::get_function_id(from);
98+
const cfg_post_dominatorst &pd=dep_graph.cfg_post_dominators().at(id);
99+
97100
// check all candidates for M
98101
for(depst::iterator
99102
it=control_deps.begin();
@@ -111,15 +114,17 @@ void dep_graph_domaint::control_dependencies(
111114
// we could hard-code assume and goto handling here to improve
112115
// performance
113116
cfg_post_dominatorst::cfgt::entry_mapt::const_iterator e=
114-
dep_graph.cfg_post_dominators().cfg.entry_map.find(*it);
115-
assert(e!=dep_graph.cfg_post_dominators().cfg.entry_map.end());
117+
pd.cfg.entry_map.find(*it);
118+
119+
assert(e!=pd.cfg.entry_map.end());
120+
116121
const cfg_post_dominatorst::cfgt::nodet &m=
117-
dep_graph.cfg_post_dominators().cfg[e->second];
122+
pd.cfg[e->second];
118123

119124
for(const auto &edge : m.out)
120125
{
121126
const cfg_post_dominatorst::cfgt::nodet &m_s=
122-
dep_graph.cfg_post_dominators().cfg[edge.first];
127+
pd.cfg[edge.first];
123128

124129
if(m_s.dominators.find(to)!=m_s.dominators.end())
125130
post_dom_one=true;
@@ -252,30 +257,39 @@ void dep_graph_domaint::transform(
252257
const namespacet &ns)
253258
{
254259
dependence_grapht *dep_graph=dynamic_cast<dependence_grapht*>(&ai);
255-
assert(dep_graph!=0);
260+
assert(dep_graph!=nullptr);
256261

257262
// propagate control dependencies across function calls
258263
if(from->is_function_call())
259264
{
260265
goto_programt::const_targett next=from;
261266
++next;
262267

263-
dep_graph_domaint *s=
264-
dynamic_cast<dep_graph_domaint*>(&(dep_graph->get_state(next)));
265-
assert(s!=0);
266-
267-
depst::iterator it=s->control_deps.begin();
268-
for(const auto &c_dep : control_deps)
268+
if(next==to)
269269
{
270-
while(it!=s->control_deps.end() && *it<c_dep)
271-
++it;
272-
if(it==s->control_deps.end() || c_dep<*it)
273-
s->control_deps.insert(it, c_dep);
274-
else if(it!=s->control_deps.end())
275-
++it;
270+
control_dependencies(from, to, *dep_graph);
271+
}
272+
else
273+
{
274+
// edge to function entry point
275+
276+
dep_graph_domaint *s=
277+
dynamic_cast<dep_graph_domaint*>(&(dep_graph->get_state(next)));
278+
assert(s!=nullptr);
279+
280+
depst::iterator it=s->control_deps.begin();
281+
for(const auto &c_dep : control_deps)
282+
{
283+
while(it!=s->control_deps.end() && *it<c_dep)
284+
++it;
285+
if(it==s->control_deps.end() || c_dep<*it)
286+
s->control_deps.insert(it, c_dep);
287+
else if(it!=s->control_deps.end())
288+
++it;
289+
}
290+
291+
control_deps.clear();
276292
}
277-
278-
control_dependencies(from, next, *dep_graph);
279293
}
280294
else
281295
control_dependencies(from, to, *dep_graph);

0 commit comments

Comments
 (0)