Function with empty implementation gives wrong unfolding/xref
Support for manual parallelization of sequential C programs.
Status: Beta
Brought to you by:
mtla
Taking the init_time() function of H.264 decoder as a study case.
We can find its node right after unfolding main(), This function has also been instrumented in win32.cil.c.
The issue is that init_time() has an empty implementation but unfolding it provides 2 nodes. These nodes also make reference to unrelated source code.
Using the project I got from you:
attached main_unfold.pdf);
file for the init_time() call stack (#2).
Last edit: Mihai T. Lazarescu 2013-09-09
I forgot to mention:those project files were produced before updating ParTools.
The up-to-date results are attached here.
See also the screenshot: unfold_main_with_init_time.pdf
Last edit: Leonardo Solis Vasquez 2013-09-05
Now I can see it. :-)
init_time() is not empty, see lcommon/src/win32.c:38:
So, the bug appears to be that the cross-reference of the
statements in its body is not right.
This may have to do with calling a function that does NOT
return a value. Can you confirm that this is true also for
the other cases?
Yes, init_time() is defined in lcommon/src/win32.c.
However, its implementation depends on ___WIN32__:
In this case ___WIN32__ has not been explicitly defined and I think the implementation is the empty one. I corroborated this with Eclipse IDE for C/C++ which provides a detailed call hierarchy view. By the way, no return value from both cases.
Moreover, we can find other functions with no return value using the same trace expansion view e.g: Configure(), defined in /ldecod/src/decoder_test.c:
The xref from the Configure() node to its source code works fine. The same is true for ParseCommand() (ldecod/src/configfile.c).
The spurious statement nodes are due to the instrumentation
of the dependencies on global variables.
Currently, these are attached to the first function called in
a source file, which for win32.c appears to be init_time().
These are declared in the function partools_decl_globals()
that is attached at the end of each annotated source, e.g.:
Now, the issues are actually:
viewer, not as node statements;
variable declarations. Locations as
"JM/ldecod/../lcommon/src/win32.c", 74 make no sense.
Last edit: Mihai T. Lazarescu 2013-09-09
Solved the location issue (item (2) above).