From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17016 invoked by alias); 5 Nov 2012 18:55:03 -0000 Received: (qmail 16911 invoked by uid 48); 5 Nov 2012 18:54:48 -0000 From: "dje at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/54791] AIX-only: Constructors are not called in main program. Date: Mon, 05 Nov 2012 18:55:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Keywords: X-Bugzilla-Severity: major X-Bugzilla-Who: dje at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-11/txt/msg00401.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54791 --- Comment #11 from David Edelsohn 2012-11-05 18:54:47 UTC --- I believe that the G++ front end tries to create a unique name from the first symbol it sees. I do not now if this is related to the constructor name collision that you are seeing. Is it valid C++ to define an object with the same name in multiple files? I cannot tell if you were doing something that happened to work but the behavior is not clearly defined by the language, or if this is allowed and does not work on AIX, in which case it is a bug. Why does inlining or not inlining affect the name collision? Do SVR4/ELF systems mangle each of the constructors uniquely? I thought that they all would end up in the ".init" sections, which will be concatenated. I am curious how the calls to the different ctors are disambiguated at link time. collect2 could warn, but it currently does not scan the constructor names it finds for duplicates in its object file scan. A warning would be nice, but I do not know if it is valid C++ that it should expect. I am not sure what you mean by order of initialization of global constructors across compilation units. This is within one library? GCC has a way to decorate constructors with a priority to order the constructors. If you mean order of constructors among multiple shared libraries, that is a separate, known issue on AIX.