Variable dependency missing in VariableClassificationBuilder for variable-size array
Consider the following program:
int main() {
int size = 2;
int a[size][size];
if (a[0][0] == 0) {
ERROR:
return 1;
}
return 0;
}
a
is clearly relevant, but size
is also need in order to correctly access a
. Since 783464fa the relevance of size
is correctly determined. However, the VariableClassificationBuilder
also has a set of dependencies between variables, and there no dependency between a
and size
exists. The following is the shortened output in VariableClassification.log
:
ALL
[main::size, main::__retval__, main::a]
DEPENDENCIES
[[main::size] --> [2],
[main::a] --> [],
[main::__retval__] --> [0, 1]]
RELEVANT VARS
[main::size, main::a]
These dependencies are not stored in VariableClassification
and thus not available to analyses, so it might be completely irrelevant. But someone who looks at the output file might get a wrong a idea. And I am not 100% sure that there are no follow-up problems resulting from this.
A fix might involve doing something like 783464fa but for VariableClassificationBuilder
instead of VariableAndFieldRelevancyComputer
. I am not even sure why both classes seem to keep track of dependencies independently.