Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions regression/goto-analyzer/dependence-graph14/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
int main()
{
int a[10];
a[2] = 2;
a[1] = 1;
int out = a[2];
return out;
}
26 changes: 26 additions & 0 deletions regression/goto-analyzer/dependence-graph14/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
CORE
main.c
--dependence-graph --show
activate-multi-line-match
^EXIT=0$
^SIGNAL=0$
\/\/ ([0-9]+).*\n.*a\[\(signed long( long)? int\)2\] = 2;(.*\n)*Data dependencies: (\1)\n(.*\n){2,3}.*out = *
--
\/\/ ([0-9]+).*\n.*a\[\(signed long( long)? int\)1\] = 1;(.*\n)*Data dependencies: (\1)\n(.*\n){2,3}.*out = *
^warning: ignoring
--

The two regex above matches output portions like shown below (with <N> being a
location number). The intention is to make sure the rw_set recognize the range
of the assignment to an array index correctly.

// <N> file main.c line 4 function main
a[(signed long int)2] = 2;
...

**** 4 file main.c line 6 function main
Data dependencies: <N>

// 4 file main.c line 6 function main
out = a[(signed long int)2];

2 changes: 1 addition & 1 deletion src/analyses/goto_rw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ void rw_range_sett::get_objects_rec(
{
range_spect range_end=size==-1 ? -1 : range_start+size;
if(size!=-1 && full_size!=-1)
range_end=std::max(range_end, full_size);
range_end=std::min(range_end, full_size);

add(mode, identifier, range_start, range_end);
}
Expand Down