Strange behaviour of size utility

Viewed 114

1st case:

#include <stdio.h>

int main(void)
{
    return 0;
}

Size output:

text       data     bss     dec     hex filename

1115        552       8    1675     68b ./a.out

2nd case:

#include <stdio.h>

int global;  // new line compared to previous case

int main(void)
{
    return 0;
}

size output:

text       data     bss     dec     hex filename
1115        552       8    1675     68b ./a.out

Ideally it should be:

bss=12 and all other (text and data) same

3rd case:

#include <stdio.h>

int global;

int main(void)
{
    static int i;  // new line compared to previous case
    return 0;
}

size output:

text       data     bss     dec     hex filename
1115        552      16    1683     693 ./a.out

this is correct

Why the output in 2nd case is not correct?

1 Answers
Related