Prevent stack variable initialization to zero with -g

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I recall reading somewhere (can't seem to find it now) that, when
compiling with -g, all stack variables are zeroed. Experience has also
shown this to be the case. However in optimized mode this can't be
relied upon - which is fine and as expected.

I was wondering if there is any way to prevent gcc from zeroing them in
"-g" mode as this tends to conceal uninitialized variables in debug
testing which then bite us in release. It would be great to be able to
force it to initialize them to some unusual byte value, but maybe that
is just wishful thinking. I have had a look through the man page but
nothing jumped out at me, maybe I missed something?

We are building on gcc 3.3.3 on Netbsd 2, and gcc 1.95.3 on Netbsd
1.6.2.

Thanks
 Stuart


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux