public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: jrumsey@blizzard.com
To: gcc-gnats@gcc.gnu.org
Subject: preprocessor/10434: Duplicate symbol __tcf_0 when using precompiled headers
Date: Fri, 18 Apr 2003 18:16:00 -0000	[thread overview]
Message-ID: <20030418181351.20636.qmail@sources.redhat.com> (raw)


>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_>=#E<BX7(4P:`Y"-.!<)04\IU+$+X4HE'S5
M\=&8[[F1UVT((!<^/QP3-T(EHZHBMFMY!S+2'W0RT8U=W258++JC5-U^^ZV)
MAE;_46]S7-6_@QW]6SK?K`K2_P_`92SR'`(MU*Q<QDHNN%%)>2=BGW/C+1B-
M80_<J(,*'L'RN:%UWQC!+E4KZ,H;M.);EQ!U]L$GQ?]16OTKU=<<U_0_=^R/
M^Y_IS2O]U_<_TG__#,$\^_/7[8=EJ>+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:


                 reply	other threads:[~2003-04-18 18:16 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20030418181351.20636.qmail@sources.redhat.com \
    --to=jrumsey@blizzard.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).