I have a code of the following structure:
void foo1(uint32_t *num_failures)
{
...
}
void foo2(uint32_t *num_failures)
{
...
}
void foo3(uint32_t *num_failures)
{
...
}
void test()
{
uint32_t num_failures = 0;
foo1(&num_failures);
foo2(&num_failures);
foo3(&num_failures);
}
Now, what I did was add the following instruction to foo1():
void foo1(uint32_t *num_failures)
{
...
(*num_failures)++;
}
And suddenly I see that stack size printed from inside foo2() is larger by 36 bytes.
I did an objdump and greped for <symbols>. Yielding the following:
Before the change:
...
00004e08 <test>:
After the change:
...
00004e08 <foo2>:
00005588 <test>:
So I guess the function foo2 stopped being inline.
Not sure if required: I'm using gcc for arc processor.
After learning some more on the subject, and seeing some lectures by Chandler Caruth, I would say the compiler decides almost indeterministicly where to inline the code. Especially when not givinig it any 'inline' hints, as in my case.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With