public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/9683: bug in initialization chains for static const variables from template classes
@ 2003-02-13 2:46 dohashi
0 siblings, 0 replies; only message in thread
From: dohashi @ 2003-02-13 2:46 UTC (permalink / raw)
To: gcc-gnats
>Number: 9683
>Category: c++
>Synopsis: bug in initialization chains for static const variables from template classes
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Feb 13 02:46:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: Darin Ohashi
>Release: 3.2.1
>Organization:
>Environment:
slackware-current
Configured with: ../gcc-3.2.1/configure --prefix=/usr --enable-shared --enable-threads=posix --enable-__cxa_atexit --disable-checking --with-gnu-ld --verbose --target=i386-slackware-linux --host=i386-slackware-linux
Thread model: posix
gcc version 3.2.1
>Description:
Initialization chains of static const variables in templates does not work properly. If a variable is initialized by a chain of two variables, neither of which is referenced, then the intialization does not occur.
template <class data> const int foo<data>::a = 1;
template <class data> const int foo<data>::b = a;
template <class data> const int foo<data>::c = b;
template <class data> const int foo<data>::d = c;
c and d will not be initialized properly if a and b are not used. If a is used, c will be initiailized, but d will not be.
>How-To-Repeat:
hades:~/project/gcc-bug> g++ bug1.cc
hades:~/project/gcc-bug> ./a.out
0
0
hades:~/project/gcc-bug> g++ -DA_C bug1.cc
hades:~/project/gcc-bug> ./a.out
1
1
hades:~/project/gcc-bug> g++ -DA_D bug1.cc
hades:~/project/gcc-bug> ./a.out
1
0
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="bug1.cc"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="bug1.cc"
CiNpbmNsdWRlIDxpb3N0cmVhbT4KCnRlbXBsYXRlIDxjbGFzcyBkYXRhPiBjbGFzcyBmb28Kewog
ICAgcHVibGljOgoJc3RhdGljIGNvbnN0IGludCBhOwoJc3RhdGljIGNvbnN0IGludCBiOwoJc3Rh
dGljIGNvbnN0IGludCBjOwoJc3RhdGljIGNvbnN0IGludCBkOwp9OwoKdGVtcGxhdGUgPGNsYXNz
IGRhdGE+IGNvbnN0IGludCBmb288ZGF0YT46OmEgPSAxOwp0ZW1wbGF0ZSA8Y2xhc3MgZGF0YT4g
Y29uc3QgaW50IGZvbzxkYXRhPjo6YiA9IGE7CnRlbXBsYXRlIDxjbGFzcyBkYXRhPiBjb25zdCBp
bnQgZm9vPGRhdGE+OjpjID0gYjsKdGVtcGxhdGUgPGNsYXNzIGRhdGE+IGNvbnN0IGludCBmb288
ZGF0YT46OmQgPSBjOwoKdHlwZWRlZiBmb288aW50PiBmb29JbnQ7CgppbnQgbWFpbiggdm9pZCAp
CnsKICAgIGZvb0ludCAqZjsKCiAgICBmID0gbmV3IGZvb0ludCgpOwoKI2lmIGRlZmluZWQgQV9D
CiAgICBzdGQ6OmNvdXQgPDwgZi0+YSA8PCAiXG4iOwogICAgc3RkOjpjb3V0IDw8IGYtPmMgPDwg
IlxuIjsKI2VsaWYgZGVmaW5lZCBBX0QKICAgIHN0ZDo6Y291dCA8PCBmLT5hIDw8ICJcbiI7CiAg
ICBzdGQ6OmNvdXQgPDwgZi0+ZCA8PCAiXG4iOwojZWxzZQogICAgc3RkOjpjb3V0IDw8IGYtPmMg
PDwgIlxuIjsKICAgIHN0ZDo6Y291dCA8PCBmLT5kIDw8ICJcbiI7CiNlbmRpZgp9Cg==
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2003-02-13 2:46 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-13 2:46 c++/9683: bug in initialization chains for static const variables from template classes dohashi
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).