int foo() {
return 42;
}
int main() {
int x = foo();
int y;
y = foo();
return 0;
}
into
int foo(void)
{
{
return (42);
}
}
int main(void)
{
int x ;
int tmp ;
int y ;
{
tmp = foo();
x = tmp;
y = foo();
return (0);
}
}
For x a temporary variable tmp is added, which is extra clutter compared to the equivalent code for y.
The temporary might be needed in general for initializers, but we should find a way to avoid it in such simple cases because this is counterproductive: writing neater code (e.g. for Goblint tests) causes uglier CIL output (and CFGs). To get more compact Goblint representations, one has to explicitly split initializers into assignments.
CIL transforms
into
For
x
a temporary variabletmp
is added, which is extra clutter compared to the equivalent code fory
. The temporary might be needed in general for initializers, but we should find a way to avoid it in such simple cases because this is counterproductive: writing neater code (e.g. for Goblint tests) causes uglier CIL output (and CFGs). To get more compact Goblint representations, one has to explicitly split initializers into assignments.