🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++.bug
Article #2101

bug 12178902 (1.36.1) - initialization of global reference objects

#2101
From: rfg
Date: Sun, 17 Dec 1989 20:08
26 lines
1529 bytes
// bug 12178902 (1.36.1) - linkage of initialized global reference objects

// If a global reference object is initialized, g++ (1.36.1) generates
// code such that (a) space is allocated for the reference object in the
// bss segment (rather than the data segment) and (b) the initialization
// is done at run-time (rather than at compile-time).

// This has two negative consequences.

// First, if there are multiple initializations of any single global
// reference object in various files (that will later be linked together)
// then the linker is unable to catch this `multiple-initialization'
// error.

// Second, it would be more efficient to have the initialization done at
// compile time.

// Note that space for other types of global initialized objects (such as
// class & struct objects, basic type objects, and pointer type objects)
// *is* allocated (and initialized) in the data segment (rather than in
// the bss segment).  Thus, multiple initialization of these other types of
// objects (in various files) can be detected by the linker.

int i;
int &ir = i;
Technical Details
Message-ID: <8912171208.aa08602@ICS.UCI.EDU>
Path: arc1-ca.pugleaf.net!utzoo!telly!attcan!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!tut.cis.ohio-state.edu!ICS.UCI.EDU!rfg

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!telly!attcan!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!tut.cis.ohio-state.edu!ICS.UCI.EDU!rfg
From: rfg@ICS.UCI.EDU
Newsgroups: gnu.g++.bug
Subject: bug 12178902 (1.36.1) - initialization of global reference objects
Message-ID: <8912171208.aa08602@ICS.UCI.EDU>
Date: 17 Dec 89 20:08:41 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 26