This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: .bss section and uninitialised variables


> In C/C++/most languages, you should not make any assumption about the
> initial value of variables - it is undefined by the language, and usually
> undefined on the platform as well.

It turns out that this is not true for Gisle's testcase: C99 explicitly says 
that 'myvar' must be initialized to 0 at run-time (C99 6.7.8 §10).

Gisle simply missed the -fcommon/-fno-common subtlety.

-- 
Eric Botcazou


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]