This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [C++ PATCH] Fix -frepo (PR c++/34178, take 2)


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>::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>::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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]