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]

G++ static assignment / initialization


     	These probably are very basic, stupid question, but I have not
been able to find any documentation.  Hopefully someone can shed some
light on some new G++ behavior (and some old behavior).

	G++ recently seems to have changed the way that it handles global
static assignment.  It previously used initialized data, but now it seems
to allocate zeroes in the data section and fill them in at runtime using
global constructor functions __static_initialization_and_destruction_N .
As far as I can tell, this was introduced in late April by Mark Mitchell
as part of the new static storage duration functionality.

	Does C++ now require this?  What are the semantics of this?  The
cases where I am seeing it are more than just static constructors that I
would expect.  I am seeing it for assignments of values defined in the
same "compilation unit" that I would have expected to see optimized into
initialized data and this was the previous behavior of G++.

	On a related note, G++ always seems to use initialized data and
not BSS common even for zero-filled, uninitialized symbols.

Thanks, David
===============================================================================
David Edelsohn                                      T.J. Watson Research Center
dje@watson.ibm.com                                  P.O. Box 218
+1 914 945 4364 (TL 862)                            Yorktown Heights, NY 10598


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