public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/7539: Constructors of static members are not called always
@ 2002-08-08  3:57 neu
  0 siblings, 0 replies; 2+ messages in thread
From: neu @ 2002-08-08  3:57 UTC (permalink / raw)
  To: gcc-gnats


>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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/4jH//JuI//U6Bp8rvdebfT3wtR362/NOEePXr06NGjR48ePXp8Nf4FExHy3AAoAAA=


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: c++/7539: Constructors of static members are not called always
@ 2002-08-19  4:56 jason
  0 siblings, 0 replies; 2+ messages in thread
From: jason @ 2002-08-19  4:56 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, neu, nobody

Synopsis: Constructors of static members are not called always

State-Changed-From-To: open->closed
State-Changed-By: jason
State-Changed-When: Mon Aug 19 04:16:19 2002
State-Changed-Why:
    duplicate of 7538

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7539


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-08-19 11:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-08  3:57 c++/7539: Constructors of static members are not called always neu
2002-08-19  4:56 jason

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).