From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13966 invoked by alias); 7 Dec 2007 04:28:08 -0000 Received: (qmail 13951 invoked by uid 22791); 7 Dec 2007 04:28:07 -0000 X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.4) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 07 Dec 2007 04:28:03 +0000 Received: (qmail 28694 invoked from network); 7 Dec 2007 04:28:01 -0000 Received: from unknown (HELO ?192.168.0.2?) (mitchell@127.0.0.2) by mail.codesourcery.com with ESMTPA; 7 Dec 2007 04:28:01 -0000 Message-ID: <4758CBCB.3030604@codesourcery.com> Date: Fri, 07 Dec 2007 04:28:00 -0000 From: Mark Mitchell User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) MIME-Version: 1.0 To: Jakub Jelinek CC: Jason Merrill , gcc-patches@gcc.gnu.org Subject: Re: [C++ PATCH] Fix -frepo (PR c++/34178, take 2) References: <20071127215831.GX16835@devserv.devel.redhat.com> <20071205151120.GA25112@devserv.devel.redhat.com> <47574A61.1060200@codesourcery.com> <20071206104553.GG25112@devserv.devel.redhat.com> In-Reply-To: <20071206104553.GG25112@devserv.devel.redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2007-12/txt/msg00308.txt.bz2 Jakub Jelinek wrote: > But in repo7.C the const static data member is aggregate, not integral or > enum. finish_static_data_member has > /* Force the compiler to know when an uninitialized static const > member is being used. */ > if (CP_TYPE_CONST_P (TREE_TYPE (decl)) && init == 0) > TREE_USED (decl) = 1; > Later on duplicate_decls clears DECL_EXTERNAL on this decl (because a > definition was parsed) and after tsubst finish_static_data_member > sets TREE_USED again. Next in instantiate_decl we call > 14742 if (TREE_PUBLIC (d) && !DECL_REALLY_EXTERN (d) && !repo_emit_p (d)) > on this, and with DECL_INTEGRAL_CONSTANT_VAR_P test in repo_emit_p that > returns 0, which means the rest of instantiate_decl is bypassed for this > decl. Then this makes into cgraph, which emits it, as the decl > is !DECL_EXTERNAL, TREE_USED etc. (and even emits it without the > initialized as common symbol, as DECL_INITIAL is NULL). I'm confused. Are we talking about the second time we process the file, at link-time? And, at that point, does the .rpo file tells the compiler that it needs to define "A D::b"? If so, repo_emit_p should be returning true anyhow. Otherwise, I think something is just going wrong with explicit template instantiation. Once we decide that D::b is going to be emitted in the front end (i.e., clear DECL_EXTERNAL), we have to process its initializer. But, the fact that it's const doesn't seem relevant to me at all. -- Mark Mitchell CodeSourcery mark@codesourcery.com (650) 331-3385 x713