public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: neu@iis.fhg.de
To: gcc-gnats@gcc.gnu.org
Subject: c++/7539: Constructors of static members are not called always
Date: Thu, 08 Aug 2002 03:57:00 -0000	[thread overview]
Message-ID: <20020808101549.7352.qmail@sources.redhat.com> (raw)


>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+rLXMiPXMO8WgaERAH8hZMXQhs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l9yBrsN0u87ME+ER748iozD
539RJ/4jH//JuI//U6Bp8rvdebfT3wtR362/NOEePXr06NGjR48ePXp8Nf4FExHy3AAoAAA=


             reply	other threads:[~2002-08-08 10:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-08  3:57 neu [this message]
2002-08-19  4:56 jason

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020808101549.7352.qmail@sources.redhat.com \
    --to=neu@iis.fhg.de \
    --cc=gcc-gnats@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).