The function ceases to be built-in. Any explanation?

I have the code for 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 is add the following command to foo1 () :

 void foo1(uint32_t *num_failures) { ... (*num_failures)++; } 

And suddenly I see that the stack size printed inside foo2 () is 36 bytes larger.

I made objdump and copied for <characters>. Having the following:

Before the change:

 ... 00004e08 <test>: 

After the change:

 ... 00004e08 <foo2>: 00005588 <test>: 

So, I think the foo2 function is no longer inline.

  • Am I right?
  • Any explanation why this happened?
  • What happened to foo3 () after the change? Did it become inline inside foo2 () or inside test () ?

Not necessary if necessary: โ€‹โ€‹I use gcc for the arc processor.

+5
source share
1 answer

Having learned a little more about the subject and having seen some lectures by Chandler Karut, I would say that the compiler almost entirely decides where to embed the code. Especially if you donโ€™t give any โ€œbuilt-inโ€ hints, as in my case.

+1
source

Source: https://habr.com/ru/post/1246068/


All Articles