This is the mail archive of the gcc-prs@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]
Other format: [Raw text]

c++/7538: Constructors of static members are not called always


>Number:         7538
>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:03 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+rLXMiPXMO8WgaERAH8hZMXQhsLKzSfUBKE8SsypTVnFpTkAbw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/4jH//JuI//U6Bp8rvdebfT3wtR362/NOEePXr06NGjR48ePXp8Nf4FExHy3AAoAAA=


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