public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: rittle@labs.mot.com
To: gcc-gnats@gcc.gnu.org
Subject: c++/8249: Objects moved from common to BSS with -fdata-sections
Date: Thu, 17 Oct 2002 03:46:00 -0000	[thread overview]
Message-ID: <20021017104056.24168.qmail@sources.redhat.com> (raw)


>Number:         8249
>Category:       c++
>Synopsis:       Objects moved from common to BSS with -fdata-sections
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Oct 17 03:46:02 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     rittle@labs.mot.com
>Release:        gcc mainline; regression from 3.2.X
>Organization:
>Environment:
Seen on both i386-*-freebsd4.7 and
alpha-*-freebsd5.7 while working on libstdc++-v3
which uses -fdata-sections by default (on some platforms).
>Description:

>How-To-Repeat:
Run:

g++ -c t2.ii
nm -C t2.o
00000000 T double_bar()
00000008 C guard variable for foo<0>::bar()::double_foo
00000000 W foo<0>::fu()
00000000 W foo<0>::bar()
00000004 C foo<0>::bar()::double_foo
         U __gxx_personality_v0
g++ -fdata-sections -c t2.ii
nm -C t2.o
00000000 T double_bar()
00000000 B guard variable for foo<0>::bar()::double_foo
00000000 W foo<0>::fu()
00000000 W foo<0>::bar()
00000000 B foo<0>::bar()::double_foo
         U __gxx_personality_v0

Notice movement from common to BSS.

When linked against t.ii (which is also compiled with -fdata-sections):
# 1 "t.C"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "t.C"
template<int __inst>
struct foo
{
  static int fu(void) { return 1; }
  static void bar(void) { static int double_foo = fu(); }
};

int double_bar(void);

int main(void)
{
  double_bar();
  foo<0>::bar();
}

Produces:

t2.o(.bss._ZGVZN3fooILi0EE3barEvE10double_foo+0x0): multiple definition of `guard variable for foo<(int)0>::bar()::double_foo'
t.o(.bss._ZGVZN3fooILi0EE3barEvE10double_foo+0x0): first defined here
t2.o(.bss._ZZN3fooILi0EE3barEvE10double_foo+0x0): multiple definition of `foo<(int)0>::bar()::double_foo'
t.o(.bss._ZZN3fooILi0EE3barEvE10double_foo+0x0): first defined here
collect2: ld returned 1 exit status
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="t2.ii"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="t2.ii"

IyAxICJ0Mi5DIgojIDEgIjxidWlsdC1pbj4iCiMgMSAiPGNvbW1hbmQgbGluZT4iCiMgMSAidDIu
QyIKdGVtcGxhdGU8aW50IF9faW5zdD4Kc3RydWN0IGZvbwp7CiAgc3RhdGljIGludCBmdSh2b2lk
KSB7IHJldHVybiAxOyB9CiAgc3RhdGljIHZvaWQgYmFyKHZvaWQpIHsgc3RhdGljIGludCBkb3Vi
bGVfZm9vID0gZnUoKTsgfQp9OwoKdm9pZCBkb3VibGVfYmFyKHZvaWQpCnsKICBmb288MD46OmJh
cigpOwp9Cg==


             reply	other threads:[~2002-10-17 10:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-17  3:46 rittle [this message]
2002-12-19 17:22 bangerth
2002-12-19 21:36 Loren James Rittle
2002-12-20  9:16 Wolfgang Bangerth
2002-12-23  9:36 Loren James Rittle

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=20021017104056.24168.qmail@sources.redhat.com \
    --to=rittle@labs.mot.com \
    --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).