From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24873 invoked by alias); 17 Oct 2002 10:46:06 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 24832 invoked by uid 71); 17 Oct 2002 10:46:04 -0000 Resent-Date: 17 Oct 2002 10:46:04 -0000 Resent-Message-ID: <20021017104604.24831.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, rittle@labs.mot.com Received: (qmail 24169 invoked by uid 61); 17 Oct 2002 10:40:56 -0000 Message-Id: <20021017104056.24168.qmail@sources.redhat.com> Date: Thu, 17 Oct 2002 03:46:00 -0000 From: rittle@labs.mot.com Reply-To: rittle@labs.mot.com To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version: gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: c++/8249: Objects moved from common to BSS with -fdata-sections X-SW-Source: 2002-10/txt/msg00661.txt.bz2 List-Id: >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 "" # 1 "" # 1 "t.C" template 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==