From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21424 invoked by alias); 18 Apr 2003 18:16:00 -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 21402 invoked by uid 71); 18 Apr 2003 18:16:00 -0000 Resent-Date: 18 Apr 2003 18:16:00 -0000 Resent-Message-ID: <20030418181600.21401.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, jrumsey@blizzard.com Received: (qmail 20637 invoked by uid 48); 18 Apr 2003 18:13:51 -0000 Message-Id: <20030418181351.20636.qmail@sources.redhat.com> Date: Fri, 18 Apr 2003 18:16:00 -0000 From: jrumsey@blizzard.com Reply-To: jrumsey@blizzard.com To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version: gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: preprocessor/10434: Duplicate symbol __tcf_0 when using precompiled headers X-SW-Source: 2003-04/txt/msg00846.txt.bz2 List-Id: >Number: 10434 >Category: preprocessor >Synopsis: Duplicate symbol __tcf_0 when using precompiled headers >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: rejects-legal >Submitter-Id: net >Arrival-Date: Fri Apr 18 18:16:00 UTC 2003 >Closed-Date: >Last-Modified: >Originator: jrumsey@blizzard.com >Release: gcc version 3.4 20030417 (experimental) >Organization: >Environment: Mandrake linux 7.2 - kernel=2.4.18-6mdkenterprise #1 SMP >Description: A header which contains an inlined static method with a static local variable requiring a destructor included in a precompiled header will cause the symbol __tcf_0 to be generated in the resulting code. If a source file that includes the precompiled header also has a function static variable requiring a destructor, it will ALSO generate the symbol __tcf_0, and the assembler will fail since the symbol exists twice. To generate the pch: $ g++ -x c++-header pchtest.h To get the error (note: If -save-temps is used on this command line, the problem goes away - it correctly generates __tcf_0 and __tcf_1. -save-temps may not be loading the precompiled version of the header): $ g++ -v pchtest.cpp Reading specs from /usr/unstable/lib/gcc-lib/i686-pc-linux-gnu/3.4/specs Configured with: ../gcc/configure --prefix=/usr/unstable Thread model: posix gcc version 3.4 20030417 (experimental) /usr/unstable/lib/gcc-lib/i686-pc-linux-gnu/3.4/cc1plus -quiet -v -D_GNU_SOURCE pchtest.cpp -quiet -dumpbase pchtest.cpp -auxbase pchtest -version -o /home/ogre/tmp/cccm6fmX.s ignoring nonexistent directory "/usr/unstable/i686-pc-linux-gnu/include" #include "..." search starts here: #include <...> search starts here: /usr/unstable/include/c++/3.4 /usr/unstable/include/c++/3.4/i686-pc-linux-gnu /usr/unstable/include/c++/3.4/backward /usr/local/include /usr/unstable/include /usr/unstable/lib/gcc-lib/i686-pc-linux-gnu/3.4/include /usr/include End of search list. GNU C++ version 3.4 20030417 (experimental) (i686-pc-linux-gnu) compiled by GNU C version 3.4 20030417 (experimental). GGC heuristics: --param ggc-min-expand=98 --param ggc-min-heapsize=128638 as -V -Qy -o /home/ogre/tmp/cckPnPbL.o /home/ogre/tmp/cccm6fmX.s GNU assembler version 2.11.92.0.12 (i586-mandrake-linux-gnu) using BFD version 2.11.92.0.12 20011121 /home/ogre/tmp/cccm6fmX.s: Assembler messages: /home/ogre/tmp/cccm6fmX.s:91: Error: symbol `__tcf_0' is already defined >How-To-Repeat: Follow commands above using these files. pchtest.ii is output from g++ -v -save-temps -x c++-header pchtest.h. begin 644 staticpchbug.tar.gz M'XL(`*4XH#X``^V6RVZ"0!2&9\L\Q8ENU+1Z0"Z)M$W8=]>^P#@2F02!"+@Q M]MD[H!1L4UW12SS?9F8.9RXP\__,=,9Z!]%&SW%TB>BY[EEY@NF`@SBW+:SR M/`]=!D[_2V.LS`NQ!6#I>AM>RKOV_)\RG64R*L*\F,HLZVD.-!%=V_YV_\VJ M?MQ_R['T63`M="T&V--ZSKCQ_>=#E2=BGW/C+1B- M80_+B7B5/34"FFXU(5A"K)&R"W?O"5Q>! M$ZV9-)&CIWPTNXDG@VE"A[;3!;OY/%#7?-J1R(,(@B`(@B`(@B`(@B`(@B`( .@B"(&^`=ZQ>KB@`H```` ` end >Fix: start_cleanup_fn in gcc/cp/decl.c has a variable: static int counter = 0; That will be 0 both when the pch is built and when it is included. If the function is called both times, it will generate two symbols both named __tcf_0 using that variable. It seems like the value of that variable needs to be saved in the pch, but doing that is beyond my knowledge of how things work. >Release-Note: >Audit-Trail: >Unformatted: