Skip to content

Commit daa7996

Browse files
authored
Merge pull request #6712 from tautschnig/feature/hide-decl
Hide declarations steps from trace when an initialisation follows
2 parents ae4f1d6 + 4daadad commit daa7996

File tree

9 files changed

+12
-12
lines changed

9 files changed

+12
-12
lines changed

regression/cbmc-cover/location-multiline-statement/multi-file.desc

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ multi-file.c
33
--cover location
44
^EXIT=0$
55
^SIGNAL=0$
6-
^\[main.coverage.2\] file multi-file.c line 10 function main block 2 \(lines [\w\- /\.\\:]*dereference.h:main:2; multi-file.c:main:10,13,14,16\): SATISFIED
6+
^\[main.coverage.2\] file multi-file.c line 13 function main block 2 \(lines [\w\- /\.\\:]*dereference.h:main:2; multi-file.c:main:10,13,14,16\): SATISFIED
77
--
88
^warning: ignoring
99
--

regression/cbmc-cover/location-multiline-statement/test.desc

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ example.c
33
--cover location
44
^EXIT=0$
55
^SIGNAL=0$
6-
^\[main.coverage.2\] file example.c line 10 function main block 2 \(lines example.c:main:10,13,14\): SATISFIED$
6+
^\[main.coverage.2\] file example.c line 13 function main block 2 \(lines example.c:main:10,13,14\): SATISFIED$
77
--
88
^warning: ignoring
99
--

regression/cbmc-cover/location15/test.desc

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ main.c
44
^EXIT=0$
55
^SIGNAL=0$
66
^\[main.coverage.1\] file main.c line 10 function main block 1.*: SATISFIED$
7-
^\[main.coverage.2\] file main.c line 10 function main block 2.*: SATISFIED$
7+
^\[main.coverage.2\] file main.c line 11 function main block 2.*: SATISFIED$
88
^\[main.coverage.3\] file main.c line 13 function main block 3.*: FAILED$
99
^\[main.coverage.4\] file main.c line 16 function main block 4.*: SATISFIED$
1010
^\[foo.coverage.1\] file main.c line 5 function foo block 1.*: FAILED$

regression/cbmc/trace-values/trace-values.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,14 @@ struct S
1111
int main()
1212
{
1313
static int static_var;
14-
int local_var;
14+
int local_var = 3;
1515
int *p=&my_nested[0].array[1];
1616
int *q=&my_nested[1].f;
1717
int *null=0;
1818
int *junk;
1919

2020
global_var=1;
2121
static_var=2;
22-
local_var=3;
2322
*p=4;
2423
*q=5;
2524
*null=6;

regression/cbmc/trace-values/trace-values.desc

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ trace-values.c
33
--trace
44
^EXIT=10$
55
^SIGNAL=0$
6-
^ local_var=0 .*$
76
^ global_var=1 .*$
87
^ static_var=2 .*$
98
^ local_var=3 .*$
@@ -16,6 +15,7 @@ trace-values.c
1615
^VERIFICATION FAILED$
1716
--
1817
^warning: ignoring
18+
^ local_var=[^3]+ .*$
1919
--
2020
Note the assignment to "null" is not included because an assignment direct to
2121
a certainly-null pointer goes to symex::invalid_object, not null$object, and is

regression/cbmc/z3/trace-char.desc

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ trace-char.c
33
--trace --smt2 --z3
44
^EXIT=10$
55
^SIGNAL=0$
6-
arr=\{ arr
76
arr=\{ '0', '1', '2', '3', '4', '5', '6', '7' \}
87
--
98
arr=(assignment removed)

regression/cbmc/z3/trace.desc

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ trace.c
33
--trace --smt2 --z3
44
^EXIT=10$
55
^SIGNAL=0$
6-
arr=\{ arr
76
arr=\{ 0, 1, 2, 3, 4, 5, 6, 17 \}
87
--
98
arr=(assignment removed)

src/goto-instrument/unwindset.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,9 @@ void unwindsett::parse_unwindset_one_loop(
126126
loop_nr_label) != instruction.labels.end())
127127
{
128128
location = instruction.source_location();
129+
// the label may be attached to the DECL part of an initializing
130+
// declaration, which we may have marked as hidden
131+
location->remove(ID_hide);
129132
}
130133
if(
131134
location.has_value() && instruction.is_backwards_goto() &&

src/goto-programs/goto_convert.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -626,12 +626,12 @@ void goto_convertt::convert_frontend_decl(
626626
}
627627
else
628628
{
629-
// this is expected to go away
630-
exprt initializer;
629+
exprt initializer = code.op1();
631630

632631
codet tmp=code;
633-
initializer=code.op1();
634632
tmp.operands().resize(1);
633+
// hide this declaration-without-initializer step in the goto trace
634+
tmp.add_source_location().set_hide();
635635

636636
// Break up into decl and assignment.
637637
// Decl must be visible before initializer.
@@ -642,7 +642,7 @@ void goto_convertt::convert_frontend_decl(
642642
if(initializer.is_not_nil())
643643
{
644644
code_assignt assign(code.op0(), initializer);
645-
assign.add_source_location() = tmp.source_location();
645+
assign.add_source_location() = initializer.find_source_location();
646646

647647
convert_assign(assign, dest, mode);
648648
}

0 commit comments

Comments
 (0)