From: Jakub Jelinek <jakub@redhat.com>
To: Mark Mitchell <mark@codesourcery.com>
Cc: Jason Merrill <jason@redhat.com>, gcc-patches@gcc.gnu.org
Subject: Re: [C++ PATCH] Fix -frepo (PR c++/34178, take 2)
Date: Thu, 06 Dec 2007 10:48:00 -0000 [thread overview]
Message-ID: <20071206104553.GG25112@devserv.devel.redhat.com> (raw)
In-Reply-To: <47574A61.1060200@codesourcery.com>
On Wed, Dec 05, 2007 at 05:03:29PM -0800, Mark Mitchell wrote:
> Jakub Jelinek wrote:
>
> > 2007-12-05 Jakub Jelinek <jakub@redhat.com>
> >
> > PR c++/34178
> > * repo.c (repo_emit_p): Return 2 for
> > DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P decls only if they are
> > const.
>
> Why don't we want to use DECL_INTEGRAL_CONSTANT_VAR_P here?
That's what my first patch version did. But that breaks e.g. the repo7.C
testcase in http://gcc.gnu.org/ml/gcc-patches/2007-12/msg00182.html
From the
#define DECL_INTEGRAL_CONSTANT_VAR_P(NODE) \
(TREE_CODE (NODE) == VAR_DECL \
&& CP_TYPE_CONST_NON_VOLATILE_P (TREE_TYPE (NODE)) \
&& INTEGRAL_OR_ENUMERATION_TYPE_P (TREE_TYPE (NODE)) \
&& DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (NODE))
conditions we already check
TREE_CODE (decl) == VAR_DECL
and
DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (decl)
in repo.c and with this patch also
CP_TYPE_CONST_P (TREE_TYPE (decl))
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).
> > * decl2.c (import_export_decl): Don't make VAR_DECLs import_p when
> > flag_use_repository and repo_emit_p returned 2.
>
> > + if ((flag_implicit_templates
> > + && !flag_use_repository)
>
> Shouldn't that condition involve emit_p, rather than just be
> !flag_use_repository?
That's not needed, we know that emit_p is 2 at this point:
emit_p = repo_emit_p (decl);
if (emit_p == 0)
import_p = true;
else if (emit_p == 1)
{
...
return;
}
if (import_p)
;
else if (...)
{
...
}
else if (DECL_TEMPLATE_INSTANTIATION (decl)
|| DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION (decl))
{
// The && !flag_use_repository addition is here.
}
emit_p can be only 0, 1, 2, if it is 0, then import_p was true
and so we don't hit this point, if it is 1, we returned early.
Jakub
next prev parent reply other threads:[~2007-12-06 10:48 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-27 22:30 [C++ PATCH] Fix -frepo (PR c++/34178) Jakub Jelinek
2007-12-05 15:14 ` [C++ PATCH] Fix -frepo (PR c++/34178, take 2) Jakub Jelinek
2007-12-06 1:03 ` Mark Mitchell
2007-12-06 10:48 ` Jakub Jelinek [this message]
2007-12-07 4:28 ` Mark Mitchell
2007-12-07 10:35 ` [C++ PATCH] Fix -frepo (PR c++/34178, c++/34340, take 3) Jakub Jelinek
2007-12-07 17:55 ` Mark Mitchell
2007-12-07 22:53 ` Jakub Jelinek
2007-12-08 1:27 ` Mark Mitchell
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=20071206104553.GG25112@devserv.devel.redhat.com \
--to=jakub@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jason@redhat.com \
--cc=mark@codesourcery.com \
/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).