Skip to content

Commit 5efb6ad

Browse files
authored
Merge pull request #4920 from karkhaz/kk-goto-rw-less-conservative
Make goto_rw less conservative
2 parents 0f20b3c + 3b13515 commit 5efb6ad

File tree

3 files changed

+26
-8
lines changed

3 files changed

+26
-8
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
int main()
2+
{
3+
char a = 'a';
4+
char *b = &a;
5+
*b = 'c';
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
CORE
2+
main.c
3+
--show-dependence-graph
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^VERIFICATION SUCCESSFUL$
7+
^Data dependencies: \d+$
8+
--
9+
^warning: ignoring
10+
^Data dependencies: \d+,\s*\d+$
11+
--
12+
This tests that the write-set of a pointer contains only the pointed-to
13+
object when the pointer is dereferenced and written to.
14+
15+
There should therefore be no data dependence between the pointer itself
16+
and the write to the pointed-to object.

src/analyses/goto_rw.cpp

+4-8
Original file line numberDiff line numberDiff line change
@@ -429,18 +429,14 @@ void rw_range_sett::get_objects_typecast(
429429

430430
void rw_range_sett::get_objects_address_of(const exprt &object)
431431
{
432-
if(object.id() == ID_string_constant ||
433-
object.id() == ID_label ||
434-
object.id() == ID_array ||
435-
object.id() == ID_null_object)
432+
if(
433+
object.id() == ID_string_constant || object.id() == ID_label ||
434+
object.id() == ID_array || object.id() == ID_null_object ||
435+
object.id() == ID_symbol)
436436
{
437437
// constant, nothing to do
438438
return;
439439
}
440-
else if(object.id()==ID_symbol)
441-
{
442-
get_objects_rec(get_modet::READ, object);
443-
}
444440
else if(object.id()==ID_dereference)
445441
{
446442
get_objects_rec(get_modet::READ, object);

0 commit comments

Comments
 (0)