[Rose-public] Liveness analysis produces incorrect results.

Maxim Baranov innotkauker at ya.ru
Thu Mar 19 06:29:29 PDT 2015

Hi everyone.

I have noticed the following things:
1. When an aggregate initializer containing numbers is present in the 
beginning of a function, no results are produced for this function.
So, if I have the following code and try to get live variables for the 
first loop using SageInterface::getLiveVariables 
the resulting sets are empty. If I generate a dot graph with the 
analysis results, labels on its edges say that there are no live 
variables for any edge.
int f()
     int c[2] = {1,2};
     for (int i = 0; i < 2; i++)
         c[i] = i;
     for (int i = 0; i < 2; i++)
         printf("%d ", c[i]);
However, if there are only variable references in the initializer, 
everything is fine. If the initializer is in some deeper scope, the 
results also seem to be correct.

2. The results fetched for nested loops are wrong. For example, if I 
change the previous code block to the following one and again query live 
variables for the first loop nest, i get live ins as {i} and live outs 
as {}, which doesn't seem to be correct at all.
int f()
         int a[m][n];
         for (unsigned i = 0; i < 2; i++)
                 for (unsigned j = 0; j < 2; j++)
                         a[i][j] = i*j;
         for (unsigned i = 0; i < 2; i++)
                 for (unsigned j = 0; j < 2; j++)
                         printf("%d ", a[i][j]);
         return 0;
If I replace the nest with printf() with a regular non-nested loop, 
which prints only elements like [i][0], a appears in live outs.
First I thought that maybe the getLiveVariables function does something 
wrong, but then I looked at the produced dot graph again. Seems that 
there are also no nodes corresponding to the first loop that have a as 
live out variable.

It would be very nice if someone fixed this, of course :)
But any ideas about where else in ROSE I can get such functionality 
would also be very helpful.

More information about the rose-public mailing list