From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8301 invoked by alias); 8 Aug 2002 10:16:07 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 8189 invoked by uid 71); 8 Aug 2002 10:16:06 -0000 Resent-Date: 8 Aug 2002 10:16:06 -0000 Resent-Message-ID: <20020808101606.8188.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-To: nobody@gcc.gnu.org Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, neu@iis.fhg.de Received: (qmail 7355 invoked by uid 61); 8 Aug 2002 10:15:49 -0000 Message-Id: <20020808101549.7352.qmail@sources.redhat.com> Date: Thu, 08 Aug 2002 03:57:00 -0000 From: neu@iis.fhg.de Reply-To: neu@iis.fhg.de To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version: gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: c++/7539: Constructors of static members are not called always X-SW-Source: 2002-08/txt/msg00160.txt.bz2 List-Id: >Number: 7539 >Category: c++ >Synopsis: Constructors of static members are not called always >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Thu Aug 08 03:16:06 PDT 2002 >Closed-Date: >Last-Modified: >Originator: Christian Neubauer >Release: gcc version 2.95.3 20010315 (SuSE) >Organization: >Environment: Linux SuSE 8.0 >Description: This example shows that the instaciation of static class members is not correctly handled depending on the link method. When using g++ to link the list of *.o's everything is correct. When linking with a library it is not. See example. Simply start compile.sh and watch the output. 1. The first version is the correct one. Right before main() the static member m_stClass of classA is constructed, which leads to the output staticClass:::staticClass() called" before main(). Then main starts and everything is fine. 2. This version shows that the linker does not resolve static member dependencies within libraries. Obviously non-static components like the function int return_five() are handled correctly. The compiler bug is that the staticClass object, which is reqired by classA, is never instanciated. >How-To-Repeat: see attached zip-file und execute compile.sh >Fix: >Release-Note: >Audit-Trail: >Unformatted: ----gnatsweb-attachment---- Content-Type: application/x-gtar; name="gcc-static-bug.tgz" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="gcc-static-bug.tgz" H4sIAOoMUj0AA+1Y3W/bNhD3M/+Km/uwBKkVSbFswAnWBVkfCuwD6PZe0BRtcZVIjaTsGEH/9x0p yZbTBC662QFa/R5sfZC8393pjnd8//b2l9/eBvbeDo6GMArDyXg8CBHTSf0fNffuMk7CQThN4vE4 nMRhhOOjeJIMIDwepR0qY6kGGEheHRjHtTkFodPiT1GU+QacESwwVZQi54HJgMoU1tSyDGzGQVW2 rGwA5B0OyjnVbkqm1gYoLBlrJ+rLXMiPXMO8WgaERAH8hZMXQhsLKzSfUBKE8SsypTVnFpTkAbwX y8zCnC+U5lBQIc/O/SBkZQUjBS/muGjxwdi7nBoDaoEs8OLWrcaUNFZXzPL0NawzgZSRYYpiVIc7 GdaL+QVms1nnDoUxmuc8He5T8Oylv6ntY5xVCEdNNjYTcumkLwQqQEjsBuNtq2VtHJtR6zk0ZkkV NyCVBc2NyletglArSFJecplyyQQOWwsnA2fONdX4IIA/5iuhKoOml0qOmqnO8mhDieRy8ZE7aWRR SWa9raUTZSstPyzEiqOiFLXLUAvUtnVBvqnd1PrQOQ81I1vyHVOBmv+NU1o7o8Ka/yM0LjbfNC55 7Z5KZyQi0DEUtaHoGrTRrdyASDk18IbcqaLwpNFJd5kWxgoq4XdezWmFFM4wGn8WwgSLbBmk/JyQ l46TbxW10wJWlseTcSD/48tJnf+vwmQaT13+T+Kwz/+nwCshWV6lHIbNl5CV5ZCQbsz739vZbJt/ r/to/Gaw8/rxZByK/zhMdvXf1cTHf9TXfyfBLv47Id8kAdYJf3ggZTXPBZsReKKueGjuz5Lza/hE SKnFCrd9N7gpVLoZpZNJPl2TfnN/QexK/uPJcPE/TZJn438aTrbxH0Whj/9J3Mf/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