This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: -fzero-initialized-in-bss
>>>>> "Michael" == Michael LeBlanc <leblanc@skycomputers.com> writes:
Michael> We're having some obscure failures with code containing
Michael> things like static struct something *ptr = 0;
Michael> The variable ptr is placed in .bss (.sbss with -Os) and
Michael> allocated via .zero. Running the program under gdb shows
Michael> the value as -1. If I recompile with
Michael> -fno-zero-initialized-in-bss, it goes to .data, the value
Michael> appears as 0, and the program runs as expected.
But .bss is supposed to be zero. If not, I'd look for a bug in the OS
(program loader). It doesn't sound like something under control of
the compiler -- the compiler is just assuming that .bss means what
it's supposed to mean.
paul